GNU/Linux Passwordless connection (using a key pair)


Example

First of all you'll need to have a key pair. If you don't have one yet, take a look at the 'Generate public and private key topic'.

Your key pair is composed by a private key (id_rsa) and a public key (id_rsa.pub). All you need to do is to copy the public key to the remote host and add its contents to the ~/.ssh/authorized_keys file.

One simple way to do that is:

ssh <user>@<ssh-server> 'cat >> ~/.ssh/authorized_keys' < id_rsa.pub

Once the public key is properly placed in your user's home directory, you just need to login using the respective private key:

ssh <user>@<ssh-server> -i id_rsa