chown to remote folder: Operation not permitted I'm making a script sync a local folder with a remote one from a NAS, the folder has been mounted into OS X with the NAS administrator name and password.

The script is:

#!/bin/bash

/usr/bin/sudo /usr/bin/rsync -rav --delete --exclude=".*" /path-to-origin/ /Volumes/NAS/path-to-destination/


The script must be executed by a user called Auser so I call the script from the command line this way:

sudo -u Auser script-to-rsync.sh


And the reply I get in Terminal is:

building file list ... done
./
rsync: chgrp "/Volumes/NAS/path-to-destination/." failed: Operation not permitted (1)
rsync: chgrp "/Volumes/NAS/path-to-destination/file.ext" failed: Operation not permitted (1)
rsync: chgrp "/Volumes/NAS/path-to-destination/." failed: Operation not permitted (1)

sent 311 bytes  received 62 bytes  746.00 bytes/sec
total size is 53864490174  speedup is 144408820.84
rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/main.c(992) [sender=2.6.9]


I'm sure it's a permissions issue, so I've tried to change the owner of the destination folder to Auser without success:

sudo chown fmserver /Volumes/NAS/path-to-destination/


And I get:

chown: /Volumes/ombacap/om15/copies/: Operation not permitted
Many foreign file systems (such as the Windows-native ones like FAT16/FAT32 etc) do not have a concept of file ownership on the filesystem level, and so the system call to change the owner is blocked with an error message.