Multiple ssh p_key

Here is a simple configuration of adding multiple ssh private key to connect to the host with different private key from client:

create a file name under .ssh

.ssh/config

Host myshortname realname.example.com
    HostName realname.example.com
    IdentityFile ~/.ssh/realname_rsa # private key for realname
    User remoteusername

Host myother realname2.example.org
    HostName realname2.example.org
    IdentityFile ~/.ssh/realname2_rsa  # different private key for realname2
    User remoteusername

Leave a Reply

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