SSH Login No Password


To enable ssh login to other hosts on your network is pretty simple to set up. Generate a public key using ssh-keygen and copy the key to the hosts you want to access without a password. It that simple.

Here's how to do it:

1. Generate a public/private rsa key pair

ssh-keygen -t rsa

2. Give file location to save key. Accept default.

Press [enter]

3. Enter password for the key
Press [enter]

4. Enter same password:
Press [enter]

Your identification has been saved in /home/patrick/.ssh/id_rsa
Your public key has been saved in /home/patrick/.ssh/

5. Copy your public key.

Caution. Make sure you copy the right key. When ssh-keygen runs, it creates two keys: and id_rsa. is the public key. The one you share. The second key, id_rsa (no .pub extension) is your private key. If you copy the wrong key to the remote host, connection without password will not work.

cp ~/.ssh/

6. Copy public key to hosts on your network.

cat >> ~/.ssh/authorized_keys

7. Add your public key after any existing entries in authorized. Don't overwrite any.

8. Test it by logging in to one of the hosts on the network

ssh host

You're in with no password. If not, you carried out one of the steps wrong. Go back and check the matches the copy. Check the file is in the correct location: ~/.ssh. Check the file is correctly named: authorized_keys.

Added Bonus

Aside from being able to log in with no password, you can also copy files without needing to authenticate yourself.

*    *    *