Auto-login to a remote machine

September 26, 2006 at 8:51 am

I often need to login to a customer’s box and get tired of typing my password all the time. Thankfully using private and public keys, I can SSH into the machine securely without needing to type in my password.

First I create a user and add him to the wheel group, so that he has sudo privileges.

useradd nate
passwd nate
usermod -G wheel nate

Then I login as this user and add my public key to the authorized keys. This public key can be found on my local machine in ~/.ssh/

cd ~
mkdir .ssh
vi .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys

Those last two lines to change the permissions are very important.

Now I can ssh into the machine, and it won’t prompt me for a password:


Technorati Tags: ,