2

I want to sync 2 servers with rsync. Os are Ubuntu 16.04
I'm using a user named here syncuser
user is in sudo group, on both servers

in /etc/sudoers I put (on both servers)

syncuser ALL=NOPASSWD: /usr/bin/rsync 

Then from local

ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub (remote server)

I can check ssh connection without credentials working
I can check sudo rsync without credentials on both
So now I run from local

sudo rsync -avz -e "ssh" --rsync-path="sudo rsync" /home/data/ syncuser@remoteserver:/home/data/

and.... now prompt password for syncuser@remoteserver !

I don't think I forgot something

1 Answer 1

1

You are running:

sudo rsync -e "ssh"

You execute ssh from root account (as you used sudo before running the rsync command) instead of syncuser account (which have ssh access to the remote-server)

In order to solve it, you can allow root@local-host access to syncuser@remote-host (e.g. using ssh-copy-id)?

2
  • You win ! Of course I had to copy root : Jul 13, 2017 at 12:30
  • @FabriceGossart - If I've answered your question please accept it
    – Yaron
    Jul 13, 2017 at 13:02

You must log in to answer this question.

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