SSH Automatic Login with Public/Private Keys

Some people like to create ssh keys in addition to entering their password for double security. I am not one of these people - I am sick of typing my damn password.

# Create public and private key files
ssh-keygen -b 1024 -f identity -P '' -t dsa

# Copy it to the server you want to connect to sans password
scp identity.pub user@SERVERNAME:~/identity.pub

# SSH to the server, add new key to authorized_keys
ssh user@SERVERNAME
mkdir .ssh
cat identity.pub >> .ssh/authorized_keys
chmod 400 .ssh/authorized_keys
exit

# Test it out
ssh -i identity user@SERVERNAME


About this entry