Ubuntu : Automatic login to SSH without a password


Here goes a tip that is useful when you make frequently ssh access to avoid having to enter the password all the time. First generate a public key from your local machine. Then copy this key to the remote machine which you want to login automaticaly. Now append you public key to the authorized_keys. It’s recommended that you remove the key file from the remote machine. Now you can do automatic login to ssh.

local$ ssh-keygen -t dsa
local$ scp ~/.ssh/id_dsa.pub user@yourserver.com:   # Don't forget the ":"
cat id_dsa.pub >> .ssh/authorized_keys
remote$ rm id_dsa.pub user@yourserver.com

After generating the public key you can do the three steps above (to append the public key in authorized_keys file) in a single command as follows:

ssh-copy-id yourserver

See ya

See more:


One Response to Ubuntu : Automatic login to SSH without a password

  1. Danny says:

    ssh keys are great… another method involves using expect.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: