1 min read

Setting up ssh keys

It is annoying to have to enter the password of a server each time you try to log in. You can set up ssh keys to avoid this:

  1. On your local machine, type the following:
ssh-keygen -t rsa

When prompted for the filename to save the key in, hit enter. This will save the rsa key pair to a default file 'id_rsa'. When prompted for the password, hit enter (to leave it blank). Hit enter again to repeat the password.

The above step should be done only once on your local machine.

  1. Once the key's image is generated, type the following:
ssh-copy-id username@server

For example, in my case it was

ssh-copy-id ramaka02@minerva.hpc.mssm.edu

Type the password for the server one last time, and you're all set! Next time, you will not be prompted for a password.

  • To set up ssh key for another server, start from Step 2.