@62mkv's answer is a much better solution. Use that.
For completeness and curiosity though, if you have an ssh server running on your local machine, you could create an ssh tunnel to allow ssh connections from the remote host on port 20202 back to the local one on port 22. Example command:
ssh -R20202:localhost:22 remoteuser@remotehost.com
This will start an ssh connection, but also set up a tunnel back to the ssh server running on your machine. Then you can do this, when ssh'ed into the remote host:
ssh -p 20202 localuser@localhost
Of course, this can quickly get confusing - especially if the technique is nested more than once. It adds a bit of latency, too - since everything you execute on your local machine is bounced through the remote host.
Additional information about ssh tunneling for those whose curiosity hasn't been satisfied yet can be found in answer to this unix stackexchange question.
Try screen or tmux. On the server side, or both sides if you like:
sudo apt-get install tmux
After logging in, start tmux.
tmux
If the connection breaks, log in again via ssh and reconnect the tmux session.
To discover the session number:
tmux ls
The output might be something like this:
0: 1 windows (created Tue Dec 25 19:20:40 2012)
Connect to the tmux numbered session like this:
tmux attach -t 0
Then you are right back where you left it. You won't have to kill the sessions. They just wait for your next visit. Or, if you just want to kill the session...
On the server side, see the /etc/ssh/sshd_config
setting for ClientAliveInterval and ClientAliveCountMax. (man 5 ssh_config
)
ClientAliveInterval 300
ClientAliveCountMax 0
Once they have been changed to your preference, restart the SSH server.
sudo /etc/init.d/ssh restart
The 300 is seconds (five minutes).
Best Answer
Run:
To get a list of Ubuntu workstations in the local network, then you can connect to them by running: