Main menu

The world where "IMPOSSIBLE" is spelt "I M POSSIBLE" !!!

SSH login without passwords

We all use ssh logins for server. May be production servers and may be deployment servers. We are all used to login using passwords but if we have many servers , remembering all passwords might be an issue. Hence, for ease of use, a small thing we can do is login to our servers without passwords. The logic behind this is putting in public keys for authorized users in .ssh/authorized_keys file.

This might help in security as well because the admin can do this procedure and authorize/ de-authorize a system from accessing the server. The passwords will remain only with admin and his/her team and hence risk of password leaking is less!

Step 1: Generate a public key:

ssh-keygen -t rsa

Step 2: Copy the public keyThe public key is by default stored in ~/.ssh/id_rsa.pub file Open this file in your favourite editor and copy the key.

You can also use xclip for this.

Step 3: Login to your serverssh username@servername

Step 4: Paste the key in ~/.ssh/authorized_keys file.A single line command to do this: