A linux system admin is commonly tasked with changing permissions on directories. A helpful solution is creating a shell script to handle the workload for you. The below example can be modified to suit your needs of automatically creating a shell script that does what you need it to do on a large scale.

First, we need to create a file list of all the directories of a folder.

ls >> list.txt

You should now have a file with one folder per line.
Next, you will want to use the sed command to insert your command at the beginning of each line before the folder name.

sed 's/^/setfacl -R -d -m g::rwx /' list.txt >> whatever.sh

sed – linux sed command
' – opens argument
s/ – option
^/ – inserts at beginning of line
setfacl -R -d -m g::rwx / – text to add (close command with /)
' – closes argument
list.txt – filename to apply argument
>> whatever.sh – output to filename whatever.sh

Finally, make the shell script (in this case ‘whatever.sh’) executable.

chmod +x whatever.sh

Execute the command on your linux machine.


If using this example, your folders should now have their group rights acl set recursively.