4.13. Using SSH agent to login on remote clusters

$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/marconi
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/leon/.ssh/marconi.
Your public key has been saved in /home/leon/.ssh/marconi.pub.
The key fingerprint is:
SHA256:Teq9Lu4Lcw3E7IhKVfDIdpXZ1fTathq1MJktAWQ8Nl0 leon@dell5520a
The key's randomart image is:
+---[RSA 4096]----+
|    ... .+o=oooE |
|   . + +o o=.... |
|    = o + o o.  .|
|   o o + +    =o |
|  . . . S .  *.oo|
| . .   . +    =.o|
|  .   o o o  . o |
|       +.  .  o  |
|       o++o  .   |
+----[SHA256]-----+

Now we copy public key to remote machine.

$ ssh-copy-id -i ~/.ssh/marconi g2kosl@s38.eufus.eu /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/home/leon/.ssh/marconi.pub” The authenticity of host ‘s38.eufus.eu (130.186.25.38)’ can’t be established. ECDSA key fingerprint is SHA256:8bFSzd26+BVm5Bz/TufbMFqPcFghziUyYJsrXdFRwFI. Are you sure you want to continue connecting (yes/no)? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys g2kosl@s38.eufus.eu’s password:

Number of key(s) added: 1

Now try logging into the machine, with: “ssh ‘g2kosl@s38.eufus.eu’” and check to make sure that only the key(s) you wanted were added.

Note

Please note that the $HOME\.ssh directory must have the correct permissions. Only the user can have write permission to $HOME\.ssh directory. To unset write permission for others write

chmod go-w ~/.ssh

This goes the same for $HOME directory.