Wednesday, May 31, 2017

Setting up a passwordless ssh login

To setup a passwordless ssh login to a server, please follow below steps:

Create a keypair using ssh-keygen (press enter on every question asked)
$ ssh-keygen

The above command will generate 2 files, ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. You can check it using ls command
$ ls .ssh

You then will need to transfer the public key to the target server, that you want to setup passwordless ssh login to. Put in the password for the user of the target server 
$ ssh-copy-id username@tar.get.ser.ver

Once done, just ssh as usual, and you will be able to login to target server without any password.
$ ssh username@tar.get.ser.ver




No comments: