2

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.

3

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
  • 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
0

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 
0
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.

0

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)

  • 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

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.