How to achieve passwordless SSH login

Ashmitha Ambastha
Jul 26, 2017 · 2 min read

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.

[ashmitha@medium]$ ssh-keygen

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:

.ssh/authorized_keys

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!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade