I have a
.ssh config file on my MacBook for connecting to a remote Ubuntu server. The config file looks like this:
Host remote_computer HostName 18.104.22.168 Port 22 User remote_username IdentityFile ~/.ssh/id_rsa RemoteCommand echo "Hello, World!"
Here's what happens when I try to connect:
local_computer:/ local_username$ ssh remote_computer Hello, World! local_computer:/ local_username$
RemoteCommand runs successfully, but then the connection closes immediately after that. This happens with any
RemoteCommand I try, but if I remove
RemoteCommand from my config file, the connection stays open:
local_computer:/ local_username$ ssh remote_computer remote_username@remote_computer:~$
Why does the connection close after successfully running the
RemoteCommand from the config file, and what can I do to prevent that?