Rsync: Preserving times/permissions: Operation not permitted

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
peter_b
Chatterbox
Posts: 383
Joined: Tue Nov 12, 2013 2:05 am

Rsync: Preserving times/permissions: Operation not permitted

Post by peter_b »

[PROBLEM]
I'm running BASH scripts to move files around in an archive.
Of course, they shouldn't run as root - but when I try to preserve permissions/ownership/times for the transferred files, I sometimes run into the problem that e.g. rsync, mv, chmod throw a warning, saying "Operation not permitted" :(

Here are some example warning messages:
rsync: failed to set times on "xxx": Operation not permitted (1)
mv: preserving times for `xxx': Operation not permitted
mv: preserving permissions for `xxx': Operation not permitted
chmod: changing permissions of `xxx': Operation not permitted

[SOLUTION]
In my case, the files' owner was someone else. I just had read/write access by group rights.
This is not enough to change the timestamp and/or ownership.

When I ran my scripts using "sudo -u USERNAME", where "USERNAME" is the owner of these files, it works correctly.

This applies at least to the following commands:

Code: Select all

$ cp -av
$ rsync -a
$ mv
$ chmod
:D
Post Reply