How to setup automatic login with ssh without a password

Install a ssh client.

Download Cygwin and install the ssh package.

If you are working with us, see our recommended setup for cygwin for what else you should install.

Auto login for ssh

Excellent instructions are provided here, a summary is provided below.

  1. Login to the ssh server with your client.

  2. Generate your key pair using the following command:

    $ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/jurn/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/jurn/.ssh/id_rsa
    Your public key has been saved in /home/jurn/.ssh/id_rsa.pub
    $ cd ~/.ssh
    $ cat id_rsa.pub >> authorized_keys
    $ chmod 600 authorized_keys

    Don't use any passphrase

  3. Log out of the server and go back to your local shell

    $ cd
    $ mkdir .ssh
  4. Copy the file id_rsa that was generated on the server into this directory. You can use sftp or scp for this.

  5. $ cd .ssh
    $ chmod 600 id_rsa
  6. You should now be able to login via ssh without having to prompt for a password.

Troubleshooting

In cygwin, your home is in the passwd file /etc/passwd, even if you set the $HOME environment variable

Check that the authorized_keys file on the server is not corrupted.

If you are having trouble you can use the -v option in ssh to give you some debugging info.

Lookup the man page for ssh if you are stuck.

Published: Sunday, 28 October 2007