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

I'm attempting to use rsync on a new RHEL server to copy files/directory from a remote Ubuntu server. I used rsync -avx remote@host.com:/var/www/ /var/www/html

I'm then prompted for the password for remote@host.com and provide it. Unfortunately, I receive permission denied (publickey,password). Note that the username I'm using on the RHEL server is different from the username on the Ubuntu server.

How do I rectify this issue?

Thanks!!

share|improve this question
1  
type the correct password. –  stew Dec 14 '11 at 18:46

2 Answers 2

up vote 4 down vote accepted

You are having a problem with ssh, not with rsync that is trying to use ssh as a transport. First get to the point where just ssh remote@host.com works, and work from there. If you are being prompted for a password but you still cannot login, then either you have the wrong password (most likely), or there is some other problem. If you are certain you have the correct password, then the best way to debug this is from the server side. First check the server logs (/var/log/secure on RH). If there is nothing useful there, my recommendation to debugging this beyond the password would be to run /usr/sbin/sshd -d -p 2222 on the server to start a sshd in debug mode, then try ssh -p 2222 remote@host.com from the client side. Then see what messages come out from the server when authentication fails.

share|improve this answer

Generate a local ssh key (ssh-keygen, hit enter 3 times) and then copy ~/.ssh/id_rsa.pub to the ~/.ssh/authorized_keys2 file on the target server, under the desired user. That's about the only way i can think of to do it. Once you have authenticated, make sure that whatever user you're using on the remote server has access to those files.

share|improve this answer
    
To clarify. when you talk about "if they were created by root", you are talking about .ssh and .ssh/authorized_keys2, right? It cannot be a problem with the permissions of the files in /var/www as he's not yet authenticated. –  stew Dec 14 '11 at 18:49
    
I'm actually referring to the files he is trying to copy. If the user who created the files set them as read only for only his user/group, then if he is logging in as any other user they'll be unable to copy them due to lack of privs. –  Matthew Dec 14 '11 at 18:53
    
Then no, not possible. He hasn't gotten past ssh authentication yet, so the permissions of those files cannot be the cause of this problem. –  stew Dec 14 '11 at 18:54
    
Ah re-reading it I see what you mean, for some reason i missed the part about the permission denied being from the login attempt. Will edit my answer. –  Matthew Dec 14 '11 at 18:55

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.