I'm setting up rsync
to transfer files from ServerA to ServerB, and need to preserve timestamps and permissions. They key here is the files are owned by a different account than the one performing the file transfer.
rsync
transfers files using the example below:
rsync -a /colorschemes/ acoder@bu.my.box.net:/colorschemes/ --delete
The -a
flag yields the following types of errors:
rsync: failed to set times on "/colorschemes/946/ex": Operation not permitted (1)
rsync: failed to set permissions on "/colorschemes/946/ex/blue.pdf": Operation not permitted (1)
On the remote system, the acoder account has a similar error when attempting to manually set permissions on a file:
[acoder@bu ~]$ chown apache:codingteam /colorschemes/946
chown: changing ownership of ‘/colorschemes/946’: Operation not permitted
This works OK, though:
[acoder@bu ~]$ sudo chown apache:codingteam /colorschemes/946
Is there a way to make the remote rsync use sudo?
sudo
with--rsync-path="sudo rsync"
but make sure you make the useracoder
require no password for usingrsync
withsudo
– Wissam Roujoulah Dec 12 '16 at 15:55--rsync-path
is used to set the path of rsync on the remote computer. Will try that and follow up. – a coder Dec 12 '16 at 15:59Defaults requiretty
line from the sudoers file. Gave that a go, and it worked.http://unix.stackexchange.com/a/122624/20107
– a coder Dec 12 '16 at 16:05