Notes on Automatic Login via SSH

This is a summary of how to set up automatic ssh login (also called "unattended login") when connecting from a local machine (i.e. the one that you're currently sitting at) to a remote machine (i.e. the one that you want to connect to via SSH).

"Automatic" in this case means that you will not be prompted for your password on connection. This setup is convenient for example if you are frequently performing operations such as remote copying (scp) or using a remote CVS repository.

These instructions are specific to UNIX/Linux; I haven't investigated how to set this up for Windows, although I gather that it's possible.

The Steps

  1. Generate your public key
    On the local machine (i.e. the one you want to connect from), execute the command ssh-keygen -t dsa
  2. Copy the public key to the remote machine
    Do e.g. scp ~/.ssh/id_dsa.pub user@remotemachine.com
  3. Add the public key to the list of authenticated keys on the remote machine
    Login to the remote machine using ssh and your password (as normal), then do cat id_dsa.pub >> .ssh/authorized_keys
  4. Clean up
    Don't forget to delete the original key files, and check that the home directory doesn't have "group-write" permissions.
  5. Check permissions on the remote .ssh and .ssh/authorized keys
    You might need to set the permissions on .ssh and .ssh/authorized_keys:
    chmod 644 .ssh/authorized_keys
    chmod 700 .ssh

Some comments

  1. I have entered blank passphrases when prompted by ssh-keygen; it's probably more secure if you enter a non-blank passphrase.


P.J.Briggs@dl.ac.uk