Created
January 3, 2018 06:40
-
-
Save ShaRose/2488132934df2daee1f681bd06865011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -d "$1" ]; then | |
echo "Instructions: | |
./procacls.sh /Path/To/Folder 'user:myuser@domain.path:rwx,group:mygroup@domain.path:rwx' | |
Outputs * for each record processed." | |
exit 1 | |
fi | |
process() | |
{ | |
setfacl -b "$1" | |
if [ -f "$1" ]; then | |
chmod 660 "$1" | |
setfacl -m "${2//:rwx/:rw}" "$1" | |
elif [ -d "$1" ]; then | |
chmod 770 "$1" | |
setfacl -d -m "$2" "$1" | |
setfacl -m "$2" "$1" | |
fi | |
restorecon "$1" | |
echo -n "*" | |
} | |
export -f process | |
processstring="process \"{}\" \"$2\"" # Yes, this is a stupid hack. It also works, so fuck it | |
find "$1" -exec bash -c "$processstring" \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment