Prep 1: setup SSH connection with the cloud

Overview

Teaching: 0 min
Exercises: 15 min
Questions
Objectives
  • Connect from your local machine to the Virtual Machine (VM) on cloud for this workshop

On the days of the workshops you will get the following:

Let’s see how to use them.

Windows users only

The best way to connect is via MobaXterm.
In MobaXterm, pick the menu item Settings -> Configuration, select the SSH tab, and then ensure that the box for X11-Forwarding is checked.

More instructions can be found in this Pawsey documentation page, but you should not need them.

Get ready with the SSH key

Assume the compressed file is named rsa_bio.zip. This is a compressed SSH key, i.e. a way to enforce security measures when connecting to remote computers such as cloud VMs.

Download the file and unzip it by double-clicking on it. The unzipped key file might be in a sub-directory called Keys. Now open up a shell terminal (or MobaXterm local terminal in Windows, using the button Start local terminal) and change directory to the directory where this unzipped key file is:

$ cd <DIRECTORY WITH YOUR UNZIPPED FILE>

Define a variable with the file full path (note the prepended $(pwd)/) and name, without the .zip extension:

$ export KEY="$(pwd)/<YOUR KEY FILE WITHOUT .ZIP>"

Check that the unzipped file is there:

$ ls $KEY
/home/ubuntu/rsa_bio

Use the following command to set appropriate access permissions:

$ chmod 600 $KEY

Connect to the VM on the Nimbus cloud

You’ll use the command ssh to connect.
It’s time to use the IP address you got; it’s a string made up of four numbers separated by dots, such as 123.123.123.123.

Assuming you’re in the directory containing the SSH key, this is the full command (macOS users, use -Y rather than -X):

$ ssh -i $KEY -X ubuntu@<YOUR IP ADDRESS>

You should get an output like:

The authenticity of host '146.118.65.140 (146.118.65.140)' can't be established.
ECDSA key fingerprint is SHA256:f4IZsAASIbZvC/Q+MN32F9jCEdvFwp5hDw9YoB7ClQw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

Reply yes and press Enter.

Now, you will get asked a passphrase:

Enter passphrase for key 'rsa_bio':

Type the one you got communicated, and press Enter.

You should now get a new prompt starting with ubuntu… you’re in the Nimbus VM!

Note: the flags -X/-Y are used to enable X11 forwarding for one exercise in the session on graphical applications. If you get errors related to X11 forwarding let us know.

Is your connection dropping?

If this happens often, edit the ssh command by adding the flag -o ServerAliveInterval=300:

$ ssh -i $KEY -X -o ServerAliveInterval=300 ubuntu@<YOUR IP ADDRESS>

Use at least two terminal tabs

We advise you to open at least two terminal tabs, and connect to the VM from both of them. In this way, you can use one to edit files, and one to execute commands, thus making your workflow more efficient.

Key Points