SSH – How to Create Multiple SSH Keys

serverssh

What would be a walkthrough on how to set up multiple SSH keys?

I'm trying to connect to my remote server and GitHub account. I've got SSH access established with GitHub, but when I used ssh-keygen -t rsa and hit Enter, the terminal prompted me if I wanted to override the one that already exists. How can I create a new SSH key just for the remote server?

Best Answer

You should specify the output file, for example:

ssh-keygen -t rsa -f ~/.ssh/my-new-key

Then to connect:

ssh -i ~/.ssh/my-new-key 192.168.x.x

Or set up an SSH configuration file:

nano ~/.ssh/config

Then put in something like:

Host my-server
    HostName 192.168.x.x
    User root
    Port 22
    IdentityFile /home/username/.ssh/my-new-key

Finally:

ssh my-server
Related Question