Using OpenSSH Without a Password

You can set up OpenSSH to connect without using a password. This is actually more secure than using a password because you must have a private key in order to connect. If you want to make things very secure you can disable password logins altogether!

First, generate a public/private DSA key pair on your client computer:

  $ ssh-keygen -t dsa -f ~/.ssh/id_dsa

When you are asked for a passphrase, leave it empty. Now send the public key to the server:

  $ cd .ssh
  $ scp id_dsa.pub user@server:~/.ssh

Next, log in to the server and add the public key to the list of authorized keys.

  $ ssh user@server

  $ cd .ssh
  $ cat id_dsa.pub >> authorized_keys2
  $ chmod 640 authorized_keys2
  $ rm -f id_dsa.pub

Note that the filename is authorized_keys2, not authorized_keys.

That's it! You're ready to ssh from the client without having to enter a password. You can connect from any client that has the private key, so keep you private key private!