Answers to: Rsync backups using sudo instead of roothttp://linuxexchange.org/questions/411/rsync-backups-using-sudo-instead-of-root<p>I'm having a little rsync problem. I am trying to move data from one server to the next using rsync. The data needs to retain file owner and permission settings. The files in question are not owned by me, but my account (on both servers) does have sudo access.</p> <p>For example, I want to copy /var/www from server1 to server2. All files are owned by user www-data. My user account on both servers is <code>sander</code> and I have sudo rights on both servers.</p> <pre><code>server1$ sudo rsync -av /var/www/ sander@server2:/var/www </code></pre> <p>does not work, because sander@server2 cannot write to /var/www and cannot change the uid/gid to www-data.</p> <pre><code>server2$ sudo rsync -av sander@server1:/var/www/ /var/www </code></pre> <p>Does not work. sander@server1 cannot read /var/www.</p> <p>How do I solve this?</p>enFri, 20 Jan 2017 16:01:13 -0000