Is there a way to run commands automatically when user logs in with SSH to Windows Server?
I tried to implement this using the AutoRun
in Command Processor registry, which runs commands when any cmd.exe
is started, but due to the complexity of the script in question, this just ends up in endless recursion every time no matter how I try to fix the situation.
I also don't want to run these commands when it's not SSH, but if it's a working option to check it's the first CMD
, not anything spawned inside it, I can check the existence of SSH_TTY
variable to exclude non-ssh logins.
You should be able to configure the default shell to be your script and have it execute the real shell at the end.
echo Welcome to my server
%COMSPEC%
See Configure default shell initialized by OpenSSH on Windows 7.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments