Passwordless access using SSH keys

Passwordless access using SSH keys

SSH keys provide a convenient way to connecting to the cluster without typing the password each time.

Linux / MacOS / Windows

Open a command prompt and generate the SSH keys running the following command. Use the default settings to generate the keys.

ssh-keygen -t rsa

This generates two keys that will be stored in your ~/.ssh directory, id_rsa (private key) and id_rsa.pub (public key). Never share your private key with anyone.

Show and copy the contents of the id_rsa.pub file. The file should contain one long line beginning with ssh-rsa:

cat ~/.ssh/id_rsa.pub ssh-rsa AAAABCDEF...ABCDEF= youruser@yourcomputer

Open a connection to the cluster (athena or apollo):

ssh yourvcueid@athena.hprc.vcu.edu or ssh yourvcueid@apollo.hprc.vcu.edu

Create the .ssh directory:

[user@cluster ~]$ mkdir -p .ssh

Copy the contents of your id_rsa.pub file into the ~/.ssh/authorized_keys file (keep the double quotation marks at the beginning and end of the ssh-rsa line).

[user@cluster ~]$ echo "ssh-rsa AAAABCDEF...ABCDEF= youruser@yourcomputer" >> ~/.ssh/authorized_keys

Ensure that the folder and file permissions are correct:

[user@cluster ~]$ chmod 700 ~/.ssh [user@cluster ~]$ chmod 644 ~/.ssh/authorized_keys

Next time you ssh into the cluster you shouldn't need to provide a password.