Passwordless SSH Authentication

This will show you how to log into SSH without having to use a password.

From the machine you want to be able ssh without a password from

ssh-keygen -t dsa

Default password, and empty passphrase.

From the same machine

cat ~/.ssh/ | ssh user@remote “cat – >> ~/.ssh/authorized_keys”

ssh user@remote

You should now be in without having to be asked a password. There are some obvious security implications here; nothing you should have to worry about if you have a strong password and good permissions on /home/user.

This is very useful for automated backups using scp/rsync.

scp -r -p ~/Important user@remote:~/backups/`date +%F`

The above command will backup /home/user/Important to /home/user/backups/2008-01-18

I’ll deal with rsync in a different post; lots of nifty stuff there. 😉

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.