2

I'm attempting to use rsync on a new RHEL server to copy files/directory from a remote Ubuntu server. I used rsync -avx [email protected]:/var/www/ /var/www/html

I'm then prompted for the password for [email protected] 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!!

1
  • 1
    type the correct password.
    – stew
    Dec 14, 2011 at 18:46

2 Answers 2

5

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 [email protected] 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 [email protected] from the client side. Then see what messages come out from the server when authentication fails.

0

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.

4
  • 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, 2011 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, 2011 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, 2011 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, 2011 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .