SSH Keys
Setting up SSH Keys between compute nodes within a HPC Cluster
When using qrsh, you make get asked for a password gain access to a compute node. If you do this frequently, it can be annoying. Since going from one node of a cluster to another node in the same cluster is across a locally controlled network, ssh keys can be setup as below to speed up access while still allowing for an encrypted connection.
In this example we are doing this on godel.vcu.edu but other clusters will follow the same proceedure
from the godel head node, make an ssh connection with one of the computer nodes, we will use godel4
ssh godel4
If it gives you this, respond with yes
The authenticity of host 'godel2 (192.168.60.2)' can't be established.RSA key fingerprint is 80:c4:a7:27:d5:aa:02:ff:45:ba:9b:92:ef:13:6c:08.Are you sure you want to continue connecting (yes/no)?
It will ask for your godel password, verify you can log in. Then exit.
Next, generate an ssh key with this command:
ssh-keygen
You will get:
$ ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/home/account/.ssh/id_rsa):
Use the default name for the file, just press enter
Enter passphrase (empty for no passphrase):
No passphrase will be used, press enter
Enter same passphrase again:
press enter again
Your identification has been saved in /home/account/.ssh/id_rsa.Your public key has been saved in /home/account/.ssh/id_rsa.pub.The key fingerprint is:SHA256:7uaH5osnGAJxYqi8S6Q3Ow45dNkcvhcdsIDeiLY blah@computerThe key's randomart image is:+---[RSA 3072]----+|o . =o.... ||o@.B.o. o . ||O+@ =. o . ||=O = .. . ||oo= .. .S ||.E... .. || . o .. || . .o= . || .B=o |+----[SHA256]-----+
Now transfer that key to the other node. On a cluster, you should only need to do this once.
ssh-copy-id godel4
It will ask you for you godel password again
Once that set is completed, your ~/.ssh directory should contain the following files:
-rw-------+ 1 cgchildr cgchildr 1.7K Jul 28 2019 id_rsa
-rw-r--r--+ 1 cgchildr cgchildr 397 Jul 28 2019 id_rsa.pub
-rw-------+ 1 cgchildr cgchildr 397 Jul 29 2019 authorized_keys
drwx------+ 65 cgchildr cgchildr 248 Mar 18 15:52 ..
-rw-------+ 1 cgchildr cgchildr 17K Mar 18 15:52 known_hosts
The permissions on these file are important and ssh key will not work if:
~/.ssh is not permission 700
~/.ssh/id_rsa is not 400
Now try logging into another node again:
ssh godel4
It should give you access without asking for a password.
If you go to another node like
ssh godel10
It may ask you this
The authenticity of host 'godel2 (192.168.60.10)' can't be established.RSA key fingerprint is 80:c4:a7:27:d5:aa:02:ff:45:ba:9b:92:ef:13:6c:08.Are you sure you want to continue connecting (yes/no)?
Just say yes
On a cluster running gridengine, qrsh is the preferred method of accessing other nodes. When ssh keys are not setup, qrsh will require a password to get to a node.
Once ssh keys are setup, try qrsh again, it should not ask for a password.