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