Chapter 4: Working Remotely from Outside the College

Connecting from outside the College

face Tom Crossland

By this point, I assume you’ve got an SSH key pair set up on your personal machine and the department file system (as described in the previous section).

In this section, we’ll be working on your personal device.

Fire up a terminal if you’re on Linux or MacOS, or Command Prompt, PowerShell, or WSL (whichever you prefer) if you’re on Windows.

For older versions of Windows (lower than the Windows 10 October 2018 update), you can download PuTTY (or the more up-to-date KiTTY), or use the Windows Subsystem for Linux (WSL) if you are still on Windows 10. You can find guides for installing and using these online.

SSH from Outside College

Try to SSH to one of the lab machines – say texelNN.doc.ic.ac.uk, choosing a random NN from 01-44 (note that we’ve included the full address here). If you are not on Imperial College’s network, this should fail.

username@MACHINE:~$ ssh texel07.doc.ic.ac.uk

It fails because the department computers are all behind a firewall, and cannot be connected to directly. In order to connect to DoC computers via SSH, you must first login to an (aptly named) “login node”. These are special machines whose job is to manage connections into the college network.

These login nodes are (note that the .doc.ic.ac.uk is necessary):

  • shell1.doc.ic.ac.uk
  • shell2.doc.ic.ac.uk
  • shell3.doc.ic.ac.uk
  • shell4.doc.ic.ac.uk
  • shell5.doc.ic.ac.uk

It doesn’t matter which one you use – just pick your favourite number! Just so long as we don’t have everyone using a single login node, we’ll be fine…

The following command will log you on to one of these login nodes:

name@HOME:~$ ssh USERNAME@shell1.doc.ic.ac.uk
# You will be asked for your SSH key passphrase here
username@vm-shell1:~$

Note that you must specify your username when logging in from outside the network. You often don’t need to do this when SSHing from one machine to another inside the network, as you’re already logged in, and the system knows who you are!

If you are using an emulator like PuTTY, the process will look a little different, but eventually you will end up with a command prompt on one of the login nodes.

You can then connect to one of the lab machines from the login node! Just SSH as we did previously (you don’t even need the full address of the machine). Pick one of the login nodes (shell1 to shell5), and then any lab machine you like – log into the one you were using in the lab session, if you like.

name@HOME:~$ ssh USERNAME@shell1.doc.ic.ac.uk
username@vm-shell1:~$ ssh oak07
username@oak07:~$ 

Note that you must NOT run complicated or intensive processes on these shell servers. They should only be treated as gateways to the internal lab machines. CSG wil be after you otherwise!

Try doing something on the machine you’re connected to! (e.g. ls, or cd around your files a little)

username@vm-shell1:~$ ssh oak07
username@oak07:~$ ls
username@oak07:~$ cd ~/modules/shell

To logout of the machine, and return to the login node, you can use the logout command (like you used to log out of your neighbour’s computer in the lab session):

username@oak07:~$ logout
username@vm-shell1:~$

The Computing Support Group (CSG) in the department have a more complete guide on connecting to DoC systems remotely.

And there you go! That’s how we can access DoC systems remotely to run commands and code.