How to install ssh keys on remote systems

This example assumes we have run a job on the bluefire.ucar.edu complex and would like to be able to transfer our data after completion on bluefire to a remote machine called providence without being prompted for a password.

First, we generate our key pair on the bluefire complex, running the "ssh-keygen" command.

   $ ssh-keygen -t rsa
   Generating public/private rsa key pair.
   Enter file in which to save the key (/home/bluefire/wombat/.ssh/id_rsa): 
   Enter passphrase (empty for no passphrase): 
   Enter same passphrase again: 
   Your identification has been saved in /home/bluefire/wombat/.ssh/id_rsa.
   Your public key has been saved in /home/bluefire/wombat/.ssh/id_rsa.pub.
   The key fingerprint is:
   46:a2:d2:a5:c3:ff:dd:12:54:ad:8a:98:b2:a2:9b:5d wombat@bf0915en

We then copy our public key file, "id_rsa.pub" to another name and transfer it to our ".ssh" directory on providence.ucar.edu. We append that to the "authorized_keys2" file:

On bluefire:

   $ cp id_rsa.pub foofire
   $ scp .ssh/foofire providence.univ.edu:.ssh
   The authenticity of host 'providence (138.117.215.218)' can't be established.
   RSA key fingerprint is 46:a2:d2:a5:c3:ff:dd:12:54:ad:8a:98:b2:a2:9b:5d
   Are you sure you want to continue connecting (yes/no)? yes
   Warning: Permanently added 'providence,138.117.215.218' (RSA) to the list of known hosts.
   wombat@providence's password:
   foofire 100% |********************| 607   00:00

On providence:

  $ cd ~/.ssh
  $ cat foofire >> authorized_keys2

File transfers initiated on bluefire can now be done to providence without the need for a password.