Monday, August 30, 2010

Automatically load sessions with SSH

To run a program after the ssh, simply pass the program at the end of the ssh command
# ssh root@remote.server.com nano

To connect into a remote screen session, it is necessary to add the "-t" flag
# ssh -t root@remote.server.com screen -dr
According to the ssh man page, the "-t" flag force pseudo-tty allocation. This can be used to execute arbi-
trary screen-based programs on a remote machine.

For the screen command "screen -dr", it refers to reattaching a session and if necessary detach it first.

Very useful indeed

No comments: