How to SSH w/o a password on FreeBSD

Adapted from a Berkeley Guide, if you want to be able to SSH from unix or linux boxes (e.g. FreeBSD) without having to repeatedly put in the password, this guide will show you how to do that.

First step, on the client do the following:

mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa

Have it use the default location (~/.ssh/id_rsa), and make sure there is no passkey. This creates a file containing the public key (id_rsa) and a file containing the private key (id_rsa.pub).

There should be one line of text in id_rsa.pub. Copy it to the server, putting it in ~/.ssh/authorized_keys2. Then execute this command:

chmod 600 authorized_keys2

That’s it! Now connection from the client to the server with this command

ssh server

If that doesn’t work (i.e. it prompts for your password), you may have to try a few things. On one box that I tried, it worked as above. On another, I had to do the following.

ssh -i ~/.ssh/id_rsa server

If that works, add or create the file and insert these two lines to ~/.ssh/config

Host server
{tab}IdentityFile ~/.ssh/id_rsa

If you SSH as much as I do, this can save lots of time.


  1. gravatar

    Ray's #1 fan Said,

    May 24, 2007 @ 10:24 am

    j00 4r3 t3h n3rd

  2. gravatar

    Phil Said,

    May 24, 2007 @ 2:00 pm

    U R My H3R0

  3. gravatar

    Raybdbomb Said,

    May 24, 2007 @ 4:29 pm

    Weird, man.

RSS feed for comments on this post · TrackBack URI

Leave a Comment