Automatically running a command right after logging in over SSH reduces repetitive typing for routine checks, one-off maintenance, and devices that expect a specific entry command instead of a full shell.
When a remote command is configured in PuTTY, the client requests command execution from the SSH server after authentication instead of starting a normal interactive shell. The server runs the command under the authenticated account, returns the output to the terminal window, and ends the session when the command finishes.
Remote commands often run with a different environment than an interactive login, so PATH and shell startup files may not behave as expected. Commands that prompt for input or require a proper terminal (including some sudo workflows) can fail or hang, and fast commands can close the window immediately when they exit.
Prefer absolute paths for non-interactive runs, such as
/usr/bin/top
, to avoid login-dependent PATH differences.
A saved remote command runs on every connect for that profile, so a destructive command can repeatedly delete data or change configuration unexpectedly.
A fast command may close the session immediately after it completes.