Hello all-

I've set up ZFS on a FreeBSD 9.0 64-bit server recently. One of the things I've 
had to learn relates to NFSv4 ACLs. I've developed two scripts to reset 
permissions- one for files and the other for folders. I've run into an issue 
with executing a script to set permissions on a bunch of folders.

The root filesystem is /data. There are a bunch of subfolders followed by more 
subfolders. Allow me to demonstrate as follows:

dougs@dorado:/# getfacl ./data
# file: ./data
# owner: root
# group: DSP-production
group:DSP-production:rwxpDdaARWcCos:fd----:allow
group:DSP-marketing:rwxpDdaARWcCos:fd----:allow
            owner@:rwxpDdaARWcCos:fd----:allow
            group@:rwxpDdaARWcCos:fd----:allow
         everyone@:r-x---a-R-c--s:------:allow
dougs@dorado:/# cd data
dougs@dorado:/data# ll
total 45
drwxrwx---+  5 root  DSP-production     5 Aug 28 10:27 ADS-New
drwxrwx---+ 60 root  DSP-production   118 Aug 27 14:17 ADS-OLD
   [ .. snip .. ]
drwxrwx---+ 12 root  DSP-production    12 Aug 27 14:16 WorkinProgress
dougs@dorado:/data# getfacl ./ADS-New/
# file: ./ADS-New/
# owner: root
# group: DSP-production
group:DSP-production:rwxpDdaARWcCos:fd----:allow
group:DSP-marketing:rwxpDdaARWcCos:fd----:allow
            owner@:rwxpDdaARWcCos:fd----:allow
            group@:rwxpDdaARWcCos:fd----:allow
         everyone@:------a-R-c--s:------:allow
dougs@dorado:/data# cd ./ADS-New/
dougs@dorado:/data/ADS-New# ll
total 9
drwxrwx---+  5 root  nobody   7 Aug 27 14:20 Artworks
drwxrwx---+  4 root  nobody   4 Jul 17 12:12 ForDSP
drwxrwx---+ 78 root  nobody  78 Jul 23 13:17 ForMarketing
dougs@dorado:/data/ADS-New# /root/bin/reset-perms-prod-mkt-dirs.sh
dougs@dorado:/data/ADS-New# getfacl ./Artworks/
# file: ./Artworks/
# owner: root
# group: nobody
group:DSP-production:rwxpDdaARWcCos:fd----:allow               <<<<<-----
group:DSP-production:rwxpDdaARWcCos:fd----:allow               <<<<<-----
group:DSP-marketing:rwxpDdaARWcCos:fd----:allow
            owner@:rwxpDdaARWcCos:fd----:allow
            group@:rwxpDdaARWcCos:fd----:allow
         everyone@:------a-R-c--s:------:allow
dougs@dorado:/data/ADS-New# cd Artworks/
dougs@dorado:/data/ADS-New/Artworks# ll
total 4234
drwxrwx---+ 2 root         nobody                2 Jul 17 12:08 Ask JoeS
drwxrwx---+ 2 root         nobody               10 Jul 17 12:12 Cool -  AD
d-w-rwx---+ 2 DSP-alfredo  nobody                2 Aug 27 14:20 Jaye Additional 
Art
-rwxrwx---+ 1 root         DSP-production  3770445 Mar 11  2010 
comingsoonIntNepal.pdf
-rwxrwx---+ 1 root         DSP-production   415338 Mar 11  2010 previewcopy.pdf
dougs@dorado:/data/ADS-New/Artworks# cd Ask\ JoeS/
dougs@dorado:/data/ADS-New/Artworks/Ask JoeS# cd ..
dougs@dorado:/data/ADS-New/Artworks# getfacl Ask\ JoeS/
# file: Ask JoeS/
# owner: root
# group: nobody
group:DSP-production:rwxpDdaARWcCos:fd----:allow               <<<<<-----
group:DSP-marketing:rwxpDdaARWcCos:fd----:allow
            owner@:rwxpDdaARWcCos:fd----:allow
            group@:rwxpDdaARWcCos:fd----:allow
         everyone@:------a-R-c--s:------:allow
dougs@dorado:/data/ADS-New/Artworks#

As you can see, the ADS-New folder where I executed the script shows duplicate 
entries of the DSP-production group whereas the "Ask Joe" subfolder underneath 
the ADS-New folder shows only one DSP-production group. If I run this script on 
the ADS-OLD folder, I see the same effect- only the first level of subfolders 
get duplicate DSP-production entries while the rest of the subfolders only 
contain one entry of the DSP-production group. Why is this happening?

The contents of the /root/bin/reset-perms-prod-mkt-dirs.sh is as follows:

#!/bin/sh
# run this script where you wish to effect the changes
# reset perms to default
find . -type d -print0 | xargs -0 setfacl -b *
# apply perms to files
find . -type d -print0 | xargs -0 setfacl -m group@:full_set:fd:allow *
find . -type d -print0 | xargs -0 setfacl -m owner@:full_set:fd:allow *
find . -type d -print0 | xargs -0 setfacl -m g:dsp-marketing:full_set:fd:allow *
find . -type d -print0 | xargs -0 setfacl -m g:dsp-production:full_set:fd:allow 
*

Um? Am I missing something?

~Doug
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to