Martin Paul Eve bio photo

Martin Paul Eve

Professor of Literature, Technology and Publishing at Birkbeck, University of London

Email Books Twitter Github Stackoverflow MLA CORE Institutional Repo Hypothes.is ORCID ID  ORCID iD Wikipedia Pictures for Re-Use

It can be very handy to be able to login to an SSH shell without supplying a password. Here's how.

Firstly, on your client machine, generate a keypair. If you are using Windows you can do this using PuTTYgen. If you are on a Nix machine issue:

ssh-keygen -t dsa

Next up, we need to copy the public key to the server. If you are on Linux you can use scp to do this:

cd .ssh/
scp id_dsa.pub server_user_name@server.address:./id_dsa.pub

If you are on Windows you could use sftp or similar to transfer the key across. You should end up with a file called id_dsa.pub in your home directory on the server.

Now, on the server, with your regular user account:

cd .ssh
touch authorized_keys2
chmod 600 authorized_keys2
cat ../id_dsa.pub >> authorized_keys2
rm ../id_dsa.pub

Now, on Windows fire up a PuTTY session specifying the private key under SSH -> Auth. On Nix, simply give:

ssh -l server_user_name server.address

With any luck, you will be sorted for password-less login!