Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Basically, as it comes from the title, I'd like to login from my workstation to a SSH server by using different account in different shells. What I'd like to do is to backup all my account from this server to my hard drive by using rsync, but as you know rsync can get a connection if the keys have been generated.

I have already an account set with key for login without pass. What I did was to generate a key on the server and then download it on my ~/.ssh folder. I tried it with another account and I chanced the name of the key. Then I download it in my ~/.ssh...but no way to get it work.

I am not an expert of this stuff. If you would provide any tips or way to set it up I would really appreciate your help.

Cheers

share|improve this question

migrated from stackoverflow.com Jun 18 '12 at 14:34

This question came from our site for professional and enthusiast programmers.

1 Answer 1

By default, SSH looks for keys with specific names, namely ~/.ssh/id_rsa, ~/.ssh/id_dsa and ~/.ssh/id_ecdsa. If your key is named something else, SSH won't find it unless you tell it about it. There are two ways to go about this.

The first is to use the SSH client configuration file. Use a Host line to match the server's hostname, and then set IdentityFile appropriately. For example:

Host server1.example.com
    IdentityFile ~/.ssh/id_rsa-server1

Host server2.example.net
    IdentityFile ~/.ssh/id_rsa-server2

The second option is to specify the key in the rsync command. To do this you need to use the -e parameter to tell rsync what transport to use. This would look something like this:

rsync -e 'ssh -i ~/.ssh/id_rsa-server1' server1.example.com:~/ ~/server1/
share|improve this answer

Your Answer

 
discard

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