setting default directory ACLs using xargs

Karl Vogel vogelke+unix at
Sat Feb 13 22:40:57 UTC 2010

>> On Fri, 12 Feb 2010 21:08:43 -0800, 
>> Doug Sampson <dougs at> said:

D> This is what led me to the workaround of:
D>     $ getfacl /aclTest/ | setfacl -d -b -n -M - /aclTest/

D> which actually works for me.  I do dread the idea of having to manually
D> apply this to all existing directories in the /data filesystem.

   If all else fails, abuse nawk:

     cd /data
     find . -type d -print |
         nawk '{printf "getfacl %s | setfacl -d -b -n -M - %s\n",$1,$1}' |
         sh -x
     exit 0

   If you have spaces in your filenames, you'll either have to use perl or
   do something dopey like this:

     cd /data
     find . -type d -print | nawk -v sq=\' '{
         printf "getfacl %s%s%s | setfacl -d -b -n -M - %s%s%s\n",
         sq, $0, sq, sq, $0, sq}' | sh -x
     exit 0

Karl Vogel                      I don't speak for the USAF or my company

Yeah, yo mama dresses you funny and you need a mouse to delete files.
                                --Markus Stumpf <maex-qmail at Space.Net>

More information about the freebsd-questions mailing list