How to achieve passwordless SSH login
SSH (Secure SHELL) is an open source and most trusted network protocol that is used to login into remote servers for execution of commands and programs. It is also used to transfer files from one computer to another computer over the network.
Step 1- Create public and private keys using ssh-keygen on local-host if you haven’t already. DON’T do this if you’ve done it earlier, It’ll overwrite on the previously created keys and that will disrupt your previous connections.
Also, if you really want to make it password-less, I recommend not putting a parse pharse in the key or else you’ll have to enter a password everytime you try to access your machines.
Step 2- Copy the public key to remote-host by executing the ssh-copy-id command. The ssh-copy-id command appends the keys to the remote-host’s .ssh/authorized_key.
[ashmitha@medium]$ ssh-copy-id root@<remote-IP>
Now try logging into the machine, with "ssh 'remote-host'", and check in:
to make sure we haven't added extra keys that you weren't expecting.
Step 3- Try to log-in to remote host without entering a password
[ashmitha@medium]$ ssh root<remote-IP>
Last login: Wed July 25 17:22:33 2017 from <local-host>
The above steps should definitely help you in establishing a password-less SSH log-in to remote host machines!