ssh – automatic remote login

Since I don’t do this often enough to remember – here’s the procedure summarized (for Linux and OS/X, on Windows use putty):

me@here is username me at ip/hostname here
user@there is username user at ip/hostname there

me@here$ cd
me@here$ ssh-keygen -t rsa

press return a few times, don’t enter passphrase. This will create a public/private RSA key pair in your .ssh folder

Create the .ssh directory on the remote device (if it doesn’t already exist), and then add the local public rsa key to it’s list of authorized keys:

me@here$ ssh user@there mkdir -p .ssh
user@there's password:
me@here$ cat .ssh/ | ssh user@there 'cat >> .ssh/authorized_keys'
user@there's password:

the next time you ssh user@there you will not be prompted for a password.

Note that some systems might require the following:

  • Placing the public key in .ssh/authorized_keys2
  • Changing permissions of .ssh to 700
  • Changing permissions of .ssh/authorized_keys2 to 640

git ssh keys on Windows

If you install git on Windows, the ssh key will be in directory

c:Program Files (x86)Git.ssh

If you have linux tools for windows installed, the .ssh folder it will use will be in your user directory

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.