Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a nas set up an am trying to rsync files to it. It works fine for file I own

$ id dogmatic69 
uid=1000(dogmatic69) gid=1000(dogmatic69) groups=1000(dogmatic69),4(adm),20(dialout),24(cdrom),33(www-data),46(plugdev),110(lpadmin),111(sambashare),112(admin)

The problem files belong to the www-data user

$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

When running there are loads of errors like:

rsync: failed to set permissions on "/some/file": Operation not permitted (1)

I have tried setting up the share for both users but still get the issue

sudo smbmount //server/development development -o credentials=/home/dogmatic69/.smbpassword,uid=33,gid=33

and

sudo smbmount //server/development development -o credentials=/home/dogmatic69/.smbpassword,uid=1000,gid=1000

all the source files are owned by www-data and have g+rw so the user dogmatic69 can view / edit them.

$ ls -al
total 956
drwxrwxr-x 11 www-data www-data   4096 2012-06-21 14:09 .
drwxr-xr-x 13 root     root       4096 2012-06-26 11:44 ..
drwxrwxr-x 17 www-data www-data   4096 2012-06-21 14:10 folder1
drwxrwxr-x  7 www-data www-data   4096 2010-10-11 02:24 folder2
-rw-rw-r--  1 www-data www-data 510649 2011-05-26 20:48 file.html
-rw-rw-r--  1 www-data www-data  78792 2011-05-26 20:15 other.html

Any idea how I can set this up so there are no errors and possibly keep the owner details correct.

Edit:

The server hosting the files is a linux based NAS, it is a simple box with no ssh and the choice of NFS or SMBFS. I played with NFS but found it pretty crap and a few people said its quite dated.

share|improve this question
    
more details please... –  Chopper3 Jul 11 '12 at 16:26
    
more details such as? –  dogmatic69 Jul 11 '12 at 16:42
add comment

2 Answers 2

Remove any options from your rsync command line to set ownership. Rsync is trying to set permissions and apparently your SMB server doesn't support that functionality.

If //server/development is a Windows box, then trying to setup ownership permissions is pretty much never going to work. If it is a Samba host, then you need to make sure the CIFS UNIX Extensions are enabled on the server, and you need to use mount.cifs not smbmount if you want to be able to use unix style permissions over SMB.

share|improve this answer
    
Strange that it has no problems when the files are mine. I will try that and see what happens. Edit: no, still the same error and files are in the share are now dogmatic69:user –  dogmatic69 Jul 11 '12 at 16:35
    
changed to $ sudo mount.cifs //server/development development -o credentials=/home/dogmatic69/.smbpassword,uid=33,gid=33 still has errors. From what I read setting uid/gid in the mount sets the permissions for the mounted files not the actual files on the server being mounted? –  dogmatic69 Jul 11 '12 at 16:40
    
Using no ownership options the error changes to "rsync: chgrp file/bah. Permission denied". –  dogmatic69 Jul 11 '12 at 16:42
    
smbmount seems to keep the permissions just fine. rsync just needed sudo in order to do it. –  dogmatic69 Jul 11 '12 at 16:55
add comment
up vote 0 down vote accepted

This was actually pretty simple.. I done some more digging the options and rsync -a combines a few options one of them being -O to maintain owner. But that option requires rsync being run as root.

Simply adding sudo to the start of the command and all is well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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