...
sets up an encrypted port forward from the external machine (where ssh runs), port 8000 to port 9000 on cpu-b12-xyz.
When you run a remote command via ssh as in
bash$ ssh cpu-b12-xyz lengthy_command
then it is important to know that 'lengthy_command
' is not associated with any (remote!) terminal. This means that when you kill ssh
on your local machine (Ctrl-C) then the remote command will keep executing (the remote command is not a child of the local 'ssh
' and cannot be notified of its death). The '-t' option forces the remote ssh server to allocate a pseudo-terminal and associates the lengthy_command
process with that terminal and this will allow propagation of signals:
bash$ ssh -tt cpu-b12-xyz lengthy_command
If you kill this ssh on your local machine then it will cause the lengthy_command
to receive a signal (via its controlling terminal) and terminate as well. Multiple 't's ensure a remote terminal is allocated even if there is no local terminal (e.g., if the ssh command is called from a daemonized script).
When you run an interactive session from remote then this often carries a lot of context information (environment, running processes etc.). It can be very painful if you get disconnected and as a consequence lose all of this context and have long-running build processes killed. Use the 'screen
' utility. If you work on AFS then screen
also keeps your tokens alive for you (until they expire, of course) - provided that you run a pagsh:
...