Setting Up an SSH Tunnel
For more information on data transfer, please see here.
In order to ssh to the cluster from outside the CS network in one command you will have to setup a ‘jump’ through a gateway node.
To ssh through a gateway server to a cluster login node use:
ssh -l <username> -J <username>@<gateway> <login node>
e.g.
ssh -l alice -J alice@tails.cs.ucl.ac.uk wise.cs.ucl.ac.uk
If you don’t want to do this every time you connect to the cluster you can edit the file ~/.ssh/config and add the following:
Host <login node>
User <your_CS_username>
HostName <login node>
ProxyJump <username>@<gateway>:22
e.g.
Host wise
User alice
HostName wise.cs.ucl.ac.uk
ProxyJump alice@tails.cs.ucl.ac.uk:22
You can then ssh to wise and this configuration will always be used.
Port Forwarding with SCP
If you are trying to copy data to and from the cluster from outside the Computer Science department, it might be necessary to set up a port forward so that you connect to a login node via a jump node. The command to set this up is
ssh -L 2222:<login node>:22 <username>@<gateway>
For example, if your username was alice and you wanted to connect to the login node called ‘comic’ via the tails gateway server, the command would be:
ssh -L 2222:comic.cs.ucl.ac.uk:22 alice@tails.cs.ucl.ac.uk
Once you have set this up, anything you send to local port 2222 will be forwarded to port 22 on comic via tails (port 22 being the standard port for ssh).
At this point, leave the previous command (ssh -L) running, and open another terminal. You can now scp your data by doing the following:
scp -P 2222 /path/to/file <username>@localhost:~/path/to/destination
e.g.
scp -P 2222 /home/alice/data.txt alice@localhost:/home/alice/data_directory
This will copy the file data.txt in the user alice’s home directory on their local machine to their home directory on the cluster, via the machine tails.
Tunelling On a Windows Machine (Using Putty)
Start Putty and select SSH in the tree on the left. In the remote command enter:
ssh -L 2222:localhost:22 comic.cs.ucl.ac.uk
Expand ssh and select tunnels. Then, enter source port 2222 and in destination enter localhost:22. Select session at the top of the tree on the left and set up a connection to tails as normal (you may want to save this before connecting to save you have to do this again). You should now have a tunnel through to comic via tails. Anything you send to port 2222 on localhost will be sent to comic via the ssh tunnel.
