38

When I use the -a option as is asked and answered in Preserve the permissions with rsync, I got a lot of "rsync: failed to set permissions on" errors.

rsync: failed to set permissions on "/ata/text/RCS/jvlc,v": Operation not permitted (1)
rsync: failed to set permissions on "/ata/text/RCS/jvm,v": Operation not permitted (1)
rsync: failed to set permissions on ...

Why is this? The files are normal files with permission of 0664.

  • Can you give us ls -al output for some of the affected files? – pdo Apr 28 '11 at 17:32
28

Most likely, rsync on the destination end is not running as a user with permission to chmod those files (which would have to be either the file's owner or root).

  • It just happened that the files are owned by _www. Changing the owner solved this issue. Thanks for the help. – prosseek Apr 28 '11 at 20:56
  • 2
    It should be noted that you'll get this error even if rsync's user is in the same group a the files. To fix this error, the files must belong to the same user as rsync, not just the group. – Cerin Dec 21 '15 at 21:16
37

This error happens, because operation for changing the permissions is not permitted. So either check if your user executing the commands have the correct permissions (e.g. he's not the owner), or your file system doesn't support it.

You can ignore the warnings by specifying the additional arguments to rsync to --no-perms and -O (--omit-dir-times) to avoid trying to set permissions and modification times on files/directories. This should solve the errors. Alternatively avoid using -a.

6

As already said, the problem occurs whenever you don't have the permission to change file permissions on the destination of rsync. However, you can avoid this error message by using the two additional arguments --no-o and --no-g.

Example:

rsync -ahv --no-o --no-g target/ destination/
  • 4
    --no-owner and --no-group don't control permissions. You'd want --no-perms for that. If you wanted to avoid trying to change ownerships you'd probably need all three flags. – roaima Jan 16 '18 at 13:22
1

Background

Typically with rsync you'll see warnings if either:

  • the rsync server at the other end does not possess permissions to execute an action associated with the following:
    • owner
    • group
    • permissions
    • access times
  • or the filesystem on the remote side does not support the same types of metadata as the sender (permissions, ownership, etc.)

These issues will manifest themselves through the rsync client that's attempting to communicate with the rsync server showing up as as messages like this when attempting to copy files/directories over to a receiver:

owner

rsync: chown "/mnt/music/The Fleetwood Mac/Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3" failed: Operation not permitted (1)

group

rsync: chgrp "/mnt/music/The Fleetwood Mac Discography by Sketch/Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3" failed: Operation not permitted (1)

permissions

rsync: failed to set permissions on "/mnt/music/The Fleetwood Mac Discography by Sketch/Trilogy - 2006/Trilogy - 2006 - CD 3": Operation not permitted (1)

In cases where the receiving side cannot perform these operations you can instruct rsync to merely skip attempting to do them, realizing that the destination will not be strictly identical with the sender's metadata around the files. This will still create identical copies of the binary portions of the files and directories.

To tell rsync not to worry about the metadata you can use the --no-OPTION to disable any of these implied options.

rsync man page
--no-OPTION
      You  may  turn off one or more implied options by prefixing the option name
      with “no-”.  Not all options may be prefixed with a “no-”: only options that
      are  implied  by  other  options (e.g.  --no-D,  --no-perms)  or  have
      different  defaults  in  various  circumstances (e.g.  --no-whole-file,
      --no-blocking-io, --no-dirs).  You may specify either the short or the long
      option name after the “no-” prefix (e.g. --no-R is the same as --no-relative).

      For  example: if you want to use -a (--archive) but don’t want -o (--owner),
      instead of converting -a into -rlptgD, you could specify -a --no-o (or -a
      --no-owner).

      The order of the options is important:  if you specify --no-r -a, the -r
      option would end up being  turned  on,  the  opposite  of  -a  --no-r.
      Note  also that the side-effects of the --files-from option are NOT positional,
      as it affects the default state of  several  options and slightly changes the
      meaning of -a (see the --files-from option for more details).

So in our case we're want to use something like this to disable things:

$ rsync -avz --no-o --no-g --no-perms <src> <dst>

Example

$ rsync -avz --delete --no-o --no-g --no-perms The\ Fleetwood\ Mac/ /mnt/music/The\ Fleetwood\ Mac/.
sending incremental file list
Trilogy - 2006/
Trilogy - 2006/Trilogy - 2006 - CD 3/
Trilogy - 2006/Trilogy - 2006 - CD 3/301_fleetwood_mac_-_love_in_store.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/302_fleetwood_mac_-_cant_go_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/303_fleetwood_mac_-_thats_alright.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/304_fleetwood_mac_-_book_of_love.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/305_fleetwood_mac_-_gypsy.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/306_fleetwood_mac_-_only_over_you.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/307_fleetwood_mac_-_empire_state.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/308_fleetwood_mac_-_straight_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/309_fleetwood_mac_-_hold_me.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/310_fleetwood_mac_-_oh_diane.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/312_fleetwood_mac_-_wish_you_were_here.mp3

sent 61993245 bytes  received 289 bytes  17712438.29 bytes/sec
total size is 2596551439  speedup is 41.88

Alternative

Another reason this is happening is because of the use of the -a switch. -a includes a family of switches:

    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)

Instead of using -a you could use the individual switches and forgo having to use the --no-OPTION's.

These are the individual options included with -a
    -r, --recursive             recurse into directories
    -l, --links                 copy symlinks as symlinks
    -p, --perms                 preserve permissions
    -t, --times                 preserve modification times
    -o, --owner                 preserve owner (super-user only)
    -g, --group                 preserve group
    -D                          same as --devices --specials
        --devices               preserve device files (super-user only)
        --specials              preserve special files

Doing things this way the above example would become this instead:

$ rsync -rltDvz --delete The\ Fleetwood\ Mac/ /mnt/music/The\ Fleetwood\ Mac/.
sending incremental file list
Trilogy - 2006/
Trilogy - 2006/Trilogy - 2006 - CD 3/
Trilogy - 2006/Trilogy - 2006 - CD 3/301_fleetwood_mac_-_love_in_store.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/302_fleetwood_mac_-_cant_go_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/303_fleetwood_mac_-_thats_alright.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/304_fleetwood_mac_-_book_of_love.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/305_fleetwood_mac_-_gypsy.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/306_fleetwood_mac_-_only_over_you.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/307_fleetwood_mac_-_empire_state.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/308_fleetwood_mac_-_straight_back.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/309_fleetwood_mac_-_hold_me.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/310_fleetwood_mac_-_oh_diane.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/311_fleetwood_mac_-_eyes_of_the_world.mp3
Trilogy - 2006/Trilogy - 2006 - CD 3/312_fleetwood_mac_-_wish_you_were_here.mp3

sent 61993245 bytes  received 289 bytes  17712438.29 bytes/sec
total size is 2596551439  speedup is 41.88
-1

I had the same issue "rsync: failed to set times on "/home/Samba_Folders/...": Operation not permitted (1)"

I followed the (excellent) advice of Cerin: "It should be noted that you'll get this error even if rsync's user is in the same group a the files. To fix this error, the files must belong to the same user as rsync, not just the group. – Cerin Dec 21 '15 at 21:16"

I changed the owner to the user making the rsync and it worked , solved the problem.

M

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.