Monday, June 29, 2009

SSH Login without Password

It's nice to log into frequently used servers without a password:

Generate an ssh rsa key with an empty paraphraze:
ssh-keygen -t rsa

Make sure user directory is private
chmod 700 .ssh

Create the .ssh in the user directory of the server (mode is important or server won't authenticate)
ssh user@server mkdir -m 700 .ssh

Append the new public key to the athorized_keys file (mode is important)
cat ~/.ssh/id_rsa.pub | ssh user@server 'cat >> ~/.ssh/authorized_keys'

On the server, add the following to /etc/ssh/sshd_config
PubkeyAuthentication yes

No comments:

Post a Comment