SSH with public and private keys

created:09 Nov 2009 @ 09:41 am
edited:09 Nov 2009 @ 09:57 am
So you get tired of typing your username and password every time you want to login to a remote system?
Well there is a nice simple solution!

  1. On the remote system (the one your connecting to) run `ssh-keygen -t rsa`. This will generate you an RSA key pair. It's best to keep them in the ~/.ssh/ directory.
  2. Copy the contents of ~/.ssh/id_rsa.pub into your local ~/.ssh/authorized_keys (if it doesn't exist, create it!). 1 host per line
  3. Connect with no user/password prompt! YAY!

This also works for scp (secure copy) which is great fun for scripts etc!