Friday, January 21, 2011

Is it possible to have more than one private/public key pair per user for SSH?

I need a user with more than one key-pair for SSH. Is that possible? Is that possible without having to specify which key to use on each command?

  • You can have multiple SSH keys (multiple identities). To use the at the command line add a -i option, e.g.

    ssh -i .ssh/id_dsa_host_1 host_1
    

    If you have a key for each server you can add the info in the .ssh/config file (see man ssh_config for details), e.g.

    Host host_1
    IdentityFile ~/.ssh/id_dsa_host_1
    
    Host host_2
    IdentityFile ~/.ssh/id_dsa_host_2
    
    Warner : `ssh-agent` can also be used to add multiple keys.

0 comments:

Post a Comment