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've got a ZFS filesystem that's shared via CIFS. Somehow, the permissions have got all messed up, to the point where the ownership is all correct but a whole bunch of files have 0000 permissions.

The files which work correctly look like this:

-rwx------+  1 guest other 3.8M 2011-05-10 14:58 Presentation.ppt

How do I copy that permissions set and apply it across the rest of the files on the filesystem?

Update

Thanks for the responses - the problem I have is that a file with 700 permissions for some reason doesn't have the delete permission, when viewed from windows:

Setting the permission gives the '+' on the file.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

You can view extended permissions with:

$ /usr/bin/ls -V Presentation.ppt

This could look like:

$ /usr/bin/ls -V Presentation.ppt
   -rw-r--r--+  1 root     staff          0 Feb  3 14:13 file.1
        user:lp:rw------------:------:allow
         owner@:--x-----------:------:deny
         owner@:rw-p---A-W-Co-:------:allow
     user:marks:r-------------:------:deny
         group@:-wxp----------:------:deny
         group@:r-------------:------:allow
      everyone@:-wxp---A-W-Co-:------:deny
      everyone@:r-----a-R-c--s:------:allow

You could then apply this set of ACL settings recursively to your share:

$ /usr/bin/chmod -R A=\
    user:lp:rw------------:------:allow, \
    owner@:--x-----------:------:deny, \
    owner@:rw-p---A-W-Co-:------:allow, \
    user:marks:r-------------:------:deny, \
    group@:-wxp----------:------:deny, \
    group@:r-------------:------:allow, \
    everyone@:-wxp---A-W-Co-:------:deny, \
    everyone@:r-----a-R-c--s:------:allow, \
    /mnt/share
share|improve this answer
    
Once I twigged that my 'ls' command was actually the GNU ls and not the Sun ls, this became a lot simpler. Why the Windows 'delete' permission is a non-trivial ACL, I've no idea. –  growse May 11 '11 at 16:24

To figure out the numeric representation:

-  rwx --- ---  
0  111 000 000
   --- --- ---
    7   0   0

So, if the owners and groups are fine, you can change all the permissions to 700.

chmod -R 700 /path/to/folders 
share|improve this answer
chmod -R 0700 /path/to/files

Although, the "+" is troubling, indicating a special ACL on the files. you can use getfacl and setfacl for those, but it's much more complicated. Check out this page for getfacl/setfacl info.

share|improve this answer

I'm not a ZFS guru, but first verify the extended permissions show up with getfacl <filename>. Assuming so, you can use that output for setfacl, which sets the permissions. Do so by first dumping the access list you want via getfacl Presentation.ppt > correctfacl.txt, then setting other files to that with setfacl -M correctfacl.txt <files_to_change> (The -R flag will make this recursive)

share|improve this answer
    
getfacl gives "File system doesn't support aclent_t style ACL's. See acl(5) for more information on Solaris ACL support." For the life of me, I cant figure out how to display the extended attributes on these files. –  growse May 11 '11 at 16:14

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.