Results 1 to 5 of 5
Hi all, i am trying to write a script that will check the ACL's on the directories and files and puts the output into a text file. Can someone please ...
- 03-29-2007 #1
File Permission check script
Hi all, i am trying to write a script that will check the ACL's on the directories and files and puts the output into a text file. Can someone please direct me to the right place. I have written some scripts but don't know where to begin.
Thanks in advance.
- 03-29-2007 #2
getfacl outputs ACL's, so you would want something like
That shows the ACL of everything under / and outputs it to /tmp/acl.txt. You could make the starting path and outputfile command line options. Something like this would do:Code:find / -exec getfacl {} \; >> /tmp/acl.txt
This basically just takes a search path and an outputfile, and executes getfacl on each entry under the search path, outputting the contents to both the terminal and the outputfile. The reason I did this is because find seemingly always returns a 1, so I couldn't put something at the end that said "Your ACL's are in $2" based on an if statement on the exit status, and "Find failed for some reason" based on a non zero exit status.Code:#!/bin/bash if [ $# -lt 2 ]; then printf "Usage: `basename $0` path_to_search output_file\n" exit 1; fi if [ -f $2 ]; then printf "$2 already exists, please choose an output file that does not exist.\ exit 1; fi (find $1 -exec getfacl {} \;) | tee $2
- 04-02-2007 #3
- 05-27-2008 #4Just Joined!
- Join Date
- May 2008
- Posts
- 10
How could I use the output from the getfacl script to create facls on another system.
- 10-14-2008 #5Just Joined!
- Join Date
- Oct 2008
- Posts
- 1
Great command...but one more step.
This is a great one liner, but I have an addition I'd like some help with. This one liner dumps things like this to the file:
# file: home/savagephp
# owner: savagephp
# group: users
user::rwx
group::--x
other::--x
I'd like to be able to grep against this output and then only output those entries that match my criteria. For example, if I want to only dump to the /tmp/acl.txt file those entries that have a group permission setting of 'r-x', how could this be done? grep by itself won't work because it only returns the line that matched and not the rest of the getfacl output for that file.
Thanks.


Reply With Quote