Using SSH keys without entering a password

Thanks to my friend, Cade, and a number of websites, I was able to figure out how to ssh into my servers at home and work, without entering a password. Here’s how I did it:

1. From the box that you primarily work from, run ssh-keygen -t rsa -b 2048. From here, two keys are created: id_rsa and The id_rsa is the private key that you will keep on your primary machine. The is what will be pushed to the servers you wish to connect to, without using a password.

2. Put id_rsa in your /home/user/.ssh directory on the primary machine and put on the server in /home/user/.ssh directory.

3. Rename to authorized_keys2 on the server. At this point, you should be able to connect from your primary machine without a password. It should be noted, however, that since the authorized+keys2 file under /home/user/.ssh, that you can only connect without a password as that user, not as root. If you wanted to do the same thing as root (which is not recommended, since we really shouldn’t ever connect to a box as root, without SUing), you’d simply put your authorized_keys2 file under /.ssh.

Note:  Your authorized_keys2 needs to have permissions of 0600.

Special thanks to the following websites, which helped a great deal: has a good tutorial that takes you to the point of creating the private and public keys.

This entry was posted in Geek and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *