Thursday, July 26, 2007

passwordless ssh/scp setup

I need to set up cron jobs which scp stuff all over the place. scp works best when you have rsa keys setup to allow you to ssh in without a password.

here are the steps to set this up (on solaris 8, possibly linux):

1) setup the public key and send it to the server
ssh-keygen -t rsa
[do not enter password when asked]
scp ~/.ssh/id_rsa.pub [user]@[server]:~/

2) open a terminal on [server] and
mkdir ~/.ssh
touch ~/.ssh/authorized_keys
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
rm ~/id_rsa.pub

Done! That was easy!

Note: if the above doesnt work for some reason, make sure that you do this to the .ssh dirs on the SERVER you are trying to connect to:
chmod go-rxw .ssh

4 comments:

  1. Thanks! Couldn't be easier ;)

    ReplyDelete
  2. best tut on this ever..!

    ReplyDelete
  3. Of all the tutorials doing the same thing, this one is the easiest to follow. FYI: it works between a Ubuntu box and a Novell box just fine.

    Thanks!

    ReplyDelete