Multiple SSH Keys

Sometimes I need to generate passwordless authentication via ssh. So here is a little tutorial:

# On local machine:
$ ssh-keygen -t rsa -f ~/.ssh/id_rsa_remotemachine
$ scp ~/.ssh/id_rsa_remotemachine.pub user@remotemachine:.ssh/
$ echo Host machine >> ~/.ssh/config
$ echo IdentityFile ~/.ssh/id_rsa_remotemachine >> ~/.ssh/config
$ echo User user >> ~/.ssh/config

# On remote machine
$ cat ~/.ssh/id_rsa_remotemachine.pub >> ~/.ssh/authorized_keys

Now login should work with “ssh remotemachine”.