Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

First, sorry if this question has already been asked/answered - I've searched but perhaps I haven't recognised the answer....

What we have is a cluster of servers which need to access a single remote server using sftp.

We are migrating from one remote server to another at the same (remote) location.

We also want to refresh the public/private key pairs on the configuration as part of an ongoing security review.

My question is - can we have multiple public/private key pairs for the same user between server A and server B?

I want to do this to allow for cutover testing - but am concerned that the software checking keys may only try one of each type (rsa/dsa?) before rejecting the connection method and moving to the next type of key.

Hope it's a straightforward question - please let me know if I need to supply more details.

share|improve this question

2 Answers 2

Yes you can have multiple keypairs for a single user. On the remote site put all of the public keys in the users ~/.ssh/authorized_keys file.

On the local site have each private key in a separate file and then use the -o IdentityFile=/path/to/privatekeyfile to specify which private key to use. You could use

sftp user@remote.tld ...

to use the default (current ?) private key and

sftp -o IdentityFile=/home/user/.ssh/usernewkey user@remote.tld ...

to use the new key.

share|improve this answer

If this question refers to a *NIX system, then Iain's answer is absolutely perfect and comprehensive.

There is, however, a slightly more inconsistent situation if it is a Windows server. In fact, not all SSH servers for the Windows platform support multiple authentication keys per user. Therefore, if you are running your SSH/SFTP server on Windows, just make sure you pick a SSH server software that supports such feature.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.