Further connection options¶
Prerequisites¶
To connect to the cluster, you need to use a terminal application. These are available on Linux and MacOS but may require configuration or installation on Windows. See the relevant section of the ScienceCloud Training Handout for more detail.
Login nodes¶
After running ssh -l shortname cluster.s3it.uzh.ch
, the load balancer redirects the requests in round-robin fashion to one of the several login nodes.
Passwordless authentication¶
First, create an SSH key on your local laptop/computer using
ssh-keygen -t rsa -b 4096
Note
If you use the default names offered by the ssh-keygen
command, your private key and public key will be called ida_rsa
and id_rsa.pub
respectively. Make sure to run the commands below using whatever name values you've chosen for your keys (i.e., update the commands accordingly).
Then, once you have located the public key that you just created (if you use the default name, it will be called id_rsa.pub
located in the ~/.ssh
folder), you will need to add this key to the authorized_keys
file on ScienceCluster. You have 2 options when doing so:
Option 1: Use ssh-copy-id from your client¶
You can use ssh-copy-id
to add the public key.
From Mac or Linux:
ssh-copy-id -i ~/path/to/local/your_public_key_name.pub shortname@cluster.s3it.uzh.ch
This will add the public ssh key to ScienceCluster, stored as a new line in the file ~/.ssh/authorized_keys
.
Option 2: Use a terminal-based text editor from the server¶
Using a terminal-based text editor to edit the authorized_keys
file is also an option if you prefer a more manual approach.
First, it is suggested to make a backup of the existing authorized_keys
file (if there is one), in case you make any errors during this process.
cp ~/.ssh/authorized_keys ~/.ssh/authorized_keys_copy
If there is no current authorized_keys
file on ScienceCluster, you can create a new file with the the nano
text editor:
nano ~/.ssh/authorized_keys
This command will open the Nano text editor and allow you to edit the new authorized_keys
file. It is important to note: each line of the authorized_keys
file is a public ssh key.
To add a new public ssh key, simply move the cursor to a new line and paste the desired public ssh key. When you are finished, exit the nano
editor with CTRL+x
. To confirm type y
then ENTER
.
For reference, you can print the value of your public key if you run cat ~/.ssh/your_public_key_name.pub
from the laptop/computer where you generated the key pair. The entire printed value will be what you copy/paste into the ~/.ssh/authorized_keys
file on ScienceCluster.
Verify a new public ssh key¶
Once you have added the public ssh key to the authorized_keys
file, you should be able to access ScienceCluster using:
ssh -i ~/.ssh/your_private_key shortname@cluster.s3it.uzh.ch
Problem solving¶
I set up my ssh key pair but I still can't log in¶
A common issue with the key authentication is incorrect permissions on the home directory, .ssh
directory, or the .ssh/authorized_keys
file on the server. The home directory should be writeable only by the owner while the other two should be accessible only by the owner. You can set the correct permissions by connecting via ssh to the server and running the following commands:
chmod 750 $HOME
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
If you aren't prompted for your password, try this command:
ssh -o PubkeyAuthentication=no -o PreferredAuthentications=password shortname@cluster.s3it.uzh.ch
I get an error message saying "Remote host identification has changed"¶
Run the following command, which will update your file ~/.ssh/known_hosts
ssh-keygen -R cluster.s3it.uzh.ch
Requesting support¶
Please add -vvv
to your ssh command, which prints a verbose output. For example,
ssh -vvv shortname@cluster.s3it.uzh.ch
and contact Science IT with the output as text or a screenshot.