If we need to set advanced/particular permission to a folder or a set of folders other than normal folder permission of 755 for directories , we can use access control lists (ACL)
We can use below bash script to set the particular permission for a set of folders
===
dir='dir1,dir2,dir3'
for d in $dir do ( cd $d && setfacl -m d:o:rwx folder/ ) done
==
First we need to assign the folder names in the variable dir.
setfacl -m d:0:rwx folder/
This command will modify the permission of others category to rwx for the directory folder/ in all directories of the variable dir.
If you experience any error like
operation not supported/permitted
tune2fs -o +acl /dev/sda1(the disk/partition where those directories belong)
the above command will include acl option in the filesystem for that particular partition.
then remount it
mount -a
-------------------------------------##############---------------------------