Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Author : darrenldl ([email protected])
- # Hello, this is my first large script, hope you find it useful : )
- # Story : I am quite into system hardening, so I use grsecurity and TOMOYO.
- # While MAC(like RBAC from grsecurity, which can restrict based on roles) are certainly useful,
- # not every system supports them.
- # Thus I think setfacl is quite useful, which I discovered a while ago, but the permission
- # resets everytime I receive updates, so I didn't rely on it too much as it's too dreadful
- # to set them all again, and too dreadful to set them in the first place as well.
- # Until recently, I came up with the idea of using a script to manipulate it, and allow user to have
- # a config for it. Hence the creation of this script to restrict user access very easily.
- # As far as I know, I don't see any similar scripts around, but if there are,
- # hope you like this alternative as well.
- # Usage : This script can help you set permissions via setfacl easily with the help of a config file
- # Note : This script will try to detect all possible config error, so the lines would look messy and clumsy,
- # since I'm not savvy in bash scripting.
- # Terminology
- # Operand = NO, RESTRICT, EXCLUDE, PERM or END
- # Target = ALL or USER
- # ACL block = Block of words which starts with NO/RESTRICT and ends with END
- # By default, permission = ---
- # Initialisation
- # config_file=/path/to/your/config/file
- config_file=setfacl_file_list
- users=( daren )
- groups=( daren users )
- line_no=1
- fl_start=0 # fl_start is used by second part of code
- fl_end=0 # fl_end is used by second part of code
- c_error=0 # c_error = config error
- c_warn=0 # c_warn = config warning counter ( non-critical mistakes )
- fl_o=0 # fl_o is used to check if operands are in order or missing
- fl_all=0 # fl_all is used to check if ALL is used
- fl_others=0 # fl_others is used to check if other words are used with ALL(if ALL is used, ALL should be the only operand)
- fl_u_valid_line=() # fl_u_valid stores flags to indicate whether users in config are present in users array, in the current line
- fl_u_checked=() # fl_u_checked stores if the user is already mentioned
- fl_g_valid_line=() # fl_g_valid stores flags to indicate whether groups in config are present in groups array, in the current line
- fl_g_checked=() # fl_g_checked stores if the group is already mentioned
- fl_u=() # fl_u is used by second part of code
- fl_g=() # fl_g ss used by second part of code
- fl_r_u=0
- fl_r_g=0
- fl_e_u=0
- fl_e_g=0
- fl_no=0 # fl_no is used in second part of code
- fl_no_b=0
- fl_f_list=0
- fl_e=0
- for (( i=0; i < ${#users[@]}; i++ )); do
- fl_u[$i]=0
- done
- for (( i=0; i < ${#groups[@]}; i++ )); do
- fl_g[$i]=0
- done
- # fl_o by default is 0
- # after RESTRICT, fl_o is set to 1
- # since EXCLUDE is optional, fl_o is not changed after EXCLUDE
- # after PERM, fl_o is set to 2
- # after END, fl_o is set back to 0
- # Hence, value of fl_o indicates the last operand used, and can also check if the correct operand is missing
- # fl_all and fl_others are used to detect if both ALL and user are specified in config
- # Misc check ( if users exist, groups exist )
- # Config check ( This part is crucial, as it ensures input are correct and will not cause error in second part )
- while read line_raw; do
- if [[ ! ($line_raw =~ ^$ || -z $line_raw || $line_raw =~ ^# ) ]]; then # Check if line is empty/null/spaces or starts with #
- a=0
- fl_all=0
- fl_others=0
- for (( i=0; i < ${#users[@]}; i++ )); do
- fl_u_valid_line[$i]=0
- fl_u_checked[$i]=0
- done
- for (( i=0; i < ${#groups[@]}; i++ )); do
- fl_g_valid_line[$i]=0
- fl_g_checked[$i]=0
- done
- line=()
- for word in $line_raw; do
- if [[ $word == \#* || $word == '#' ]]; then
- # If word starts with #, stop reading (probably is a comment)
- break
- fi
- #echo $word
- # Uncomment echo $word to see what words this script will actually process
- line[$a]=${word}
- ((a++))
- done
- if (( $fl_f_list == 0 )); then
- case ${line[0]} in
- NO ) if (( $fl_o != 0 )); then
- echo "$line_no : Missing END before current line"
- c_error=1
- break
- fi
- if (( $fl_no == 1 )); then
- echo "$line_no : NO cannot be repeated"
- c_error=1
- break
- fi
- if (( ${#line[@]} > 1 )); then
- echo "$line_no : NO - too many arguments"
- c_error=1
- break
- fi
- fl_no=1
- # No modification of fl_o, since NO is optional
- ;;
- RESTRICT ) if (( $fl_o != 0 )) && (( $fl_o != 1 )); then
- # Check if previous operand is either END or RESTRICT
- echo "$line_no : Missing END before current line"
- c_error=1
- break
- fi # fl_o = 0 or 1 is accepted
- fl_o=1
- fl_e=0
- case ${line[1]} in
- USER ) if (( $fl_r_u == 1 )); then
- echo "$line_no : You can only specify RESTRICT USER once in each block"
- c_error=1
- break
- fi
- fl_r_u=1
- if (( ${#line[@]} > $[2+${#users[@]}] )); then
- # Even if the user types ALL, it shouldn't exceed the limit
- # This will still be positive if you use ALL, but have an empty users array
- echo "$line_no : RESTRICT USER - too many users"
- c_error=1
- break
- fi
- for (( i=2; i < ${#line[@]}; i++ )); do
- if [[ ${line[$i]} == "ALL" ]]; then # Check if ALL or users exist
- fl_all=1
- else
- fl_others=1
- fi
- if (( $fl_all == 1 )) && (( $fl_others == 1 )); then break; fi # End for loop
- done
- if (( $fl_all == 1 && $fl_others == 1 )); then # Check if ALL is used with other users
- echo "$line_no : No other users should be specified with ALL"
- c_error=1
- break
- else if (( $fl_all == 0 )) && (( $fl_others == 1 )); then # Only users, no ALL
- # If ALL is not specified, check specified users
- for (( i=2; i < ${#line[@]}; i++ )); do # Check if users are valid elements of users array
- for (( j=0; j < ${#users[@]}; j++ )); do
- if [[ ${line[$i]} == ${users[$j]} ]] && !(( ${fl_u_checked[$j]} == 1 )); then
- fl_u_valid_line[$[$i-2]]=1
- fl_u_checked[$j]=1 # Set 1 to indicate user is checked
- #echo "$line_no : ignored user : ${users[$j]}"
- else if [[ ${line[$i]} == ${users[$j]} ]] && (( ${fl_u_checked[$j]} == 1 )); then
- echo "$line_no : user ${users[$j]} is repeated"
- ((c_warn++))
- fl_u_valid_line[$[$i-2]]=1
- # Don't set fl_u_checked since it's repeated
- fi
- fi
- done
- done
- for (( i=2; i < ${#line[@]}; i++ )); do # Report invalid users
- if (( ${fl_u_valid_line[$[$i-2]]} == 0 )); then
- echo "$line_no : RESTRICT USER - user ${line[$i]} is not present in users array"
- ((c_warn++))
- fi
- done
- fi
- fi
- ;;
- GROUP ) if (( $fl_r_g == 1 )); then
- echo "$line_no : You can only specify RESTRICT GROUP once in each block"
- c_error=1
- break
- fi
- fl_r_g=1
- if (( ${#line[@]} > $[2+${#groups[@]}] )); then
- # Even if ALL is specified, it shouldn't exceed the limit
- # This will still be positive if you use ALL, but have an empty groups array
- echo "$line_no : RESTRICT GROUP - too many groups"
- c_error=1
- break
- fi
- for (( i=2; i < ${#line[@]}; i++ )); do
- if [[ ${line[$i]} == "ALL" ]]; then # Check if ALL or users exist
- fl_all=1
- else
- fl_others=1
- fi
- if (( $fl_all == 1 )) && (( $fl_others == 1 )); then break; fi # End for loop
- done
- if (( $fl_all == 1 && $fl_others == 1 )); then # Check if ALL is used with other users
- echo "$line_no : No other groups should be specified with ALL"
- c_error=1
- break
- else if (( $fl_all == 0 )) && (( $fl_others == 1 )); then # Only groups, no ALL
- # If ALL is not specified, check specified groups
- for (( i=2; i < ${#line[@]}; i++ )); do # Check if users are valid elements of users array
- for (( j=0; j < ${#groups[@]}; j++ )); do
- if [[ ${line[$i]} == ${groups[$j]} ]] && !(( ${fl_g_checked[$j]} == 1 )); then
- fl_g_valid_line[$[$i-2]]=1
- fl_g_checked[$j]=1 # Set 1 to indicate user is checked
- #echo "$line_no : ignored user : ${users[$j]}"
- else if [[ ${line[$i]} == ${groups[$j]} ]] && (( ${fl_g_checked[$j]} == 1 )); then
- echo "$line_no : group ${groups[$j]} is repeated"
- ((c_warn++))
- fl_g_valid_line[$[$i-2]]=1
- # Don't set fl_g_checked since it's repeated
- fi
- fi
- done
- done
- for (( i=2; i < ${#line[@]}; i++ )); do # Report invalid users
- if (( ${fl_g_valid_line[$[$i-2]]} == 0 )); then
- echo "$line_no : RESTRICT GROUP - group ${line[$i]} is not present in groups array"
- ((c_warn++))
- fi
- done
- fi
- fi
- ;;
- * ) echo "$line_no : RESTRICT - missing target"
- c_error=1
- break
- ;;
- esac
- ;;
- EXCLUDE ) if (( $fl_o == 0 )); then
- echo "$line_no : Missing RESTRICT before current line"
- c_error=1
- break
- else if (( $fl_o == 2 )); then
- echo "$line_no : PERM is before EXCLUDE"
- c_error=1
- break
- fi
- fi # fl_o = 1 is accepted
- case ${line[1]} in
- USER ) if (( $fl_e_u == 1 )); then
- echo "$line_no : You can only specify EXCLUDE USER once in each block"
- c_error=1
- break
- fi
- fl_e_u=1
- for (( i=2; i < ${#line[@]}; i++ )); do
- if [[ ${line[$i]} == "ALL" ]]; then
- echo "$line_no : EXCLUDE USER ALL is not allowed"
- c_error=1
- break # Break first loop
- fi
- done
- if (( $c_error == 1 )); then break; fi # Break second loop
- if [[ ${#line[@]} > $[2+${#users[@]}] ]]; then
- echo "$line_no : EXCLUDE USER - too many users"
- c_error=1
- break
- fi
- # Since ALL is not present, check specified users
- for (( i=2; i < ${#line[@]}; i++ )); do # Check if users are valid elements of users array
- for (( j=0; j < ${#users[@]}; j++ )); do
- if [[ ${line[$i]} == ${users[$j]} ]] && !(( ${fl_u_checked[$j]} == 1 )); then
- fl_u_valid_line[$[$i-2]]=1
- fl_u_checked[$j]=1 # Set 1 to indicate user is checked
- #echo "$line_no : ignored user : ${users[$j]}"
- else if [[ ${line[$i]} == ${users[$j]} ]] && (( ${fl_u_checked[$j]} == 1 )); then
- echo "$line_no : user ${users[$j]} is repeated"
- ((c_warn++))
- fl_u_valid_line[$[$i-2]]=1
- # Don't set fl_u_checked since it's repeated
- fi
- fi
- done
- done
- for (( i=2; i < ${#line[@]}; i++ )); do # Report invalid users
- if (( ${fl_u_valid_line[$[$i-2]]} == 0 )); then
- echo "$line_no : RESTRICT USER - user ${line[$i]} is not present in users array"
- ((c_warn++))
- fi
- done
- ;;
- GROUP ) if (( $fl_e_g == 1 )); then
- echo "$line_no : You can only specify EXCLUDE GROUP once in each block"
- c_error=1
- break
- fi
- fl_e_g=1
- for (( i=2; i < ${#line[@]}; i++ )); do
- if [[ ${line[$i]} == "ALL" ]]; then
- echo "$line_no : EXCLUDE USER ALL is not allowed"
- c_error=1
- break # Break first loop
- fi
- done
- if (( $c_error == 1 )); then break; fi # Break second loop
- if [[ ${#line[@]} > $[2+${#users[@]}] ]]; then
- echo "$line_no : EXCLUDE USER - too many users"
- c_error=1
- break
- fi
- # Since ALL is not present, check specified users
- for (( i=2; i < ${#line[@]}; i++ )); do # Check if users are valid elements of users array
- for (( j=0; j < ${#users[@]}; j++ )); do
- if [[ ${line[$i]} == ${users[$j]} ]] && !(( ${fl_u_checked[$j]} == 1 )); then
- fl_u_valid_line[$[$i-2]]=1
- fl_u_checked[$j]=1 # Set 1 to indicate user is checked
- #echo "$line_no : ignored user : ${users[$j]}"
- else if [[ ${line[$i]} == ${users[$j]} ]] && (( ${fl_u_checked[$j]} == 1 )); then
- echo "$line_no : user ${users[$j]} is repeated"
- ((c_warn++))
- fl_u_valid_line[$[$i-2]]=1
- # Don't set fl_u_checked since it's repeated
- fi
- fi
- done
- done
- for (( i=2; i < ${#line[@]}; i++ )); do # Report invalid users
- if (( ${fl_u_valid_line[$[$i-2]]} == 0 )); then
- echo "$line_no : RESTRICT USER - user ${line[$i]} is not present in users array"
- ((c_warn++))
- fi
- done
- ;;
- * ) echo "$line_no : EXCLUDE - missing target"; c_error=1; break
- ;;
- esac
- # No modification of fl_o, since EXCLUDE is optional
- ;;
- PERM ) if (( $fl_o == 0 )); then
- echo "$line_no : Missing RESTRICT before current line"
- c_error=1
- break
- else if (( $fl_o == 2 )); then
- echo "$line_no : PERM should not be repeated"
- c_error=1
- break
- fi
- fi # fl_o = 1 is accepted
- fl_o=2
- if (( ${#line[@]} > 2 )); then
- echo "$line_no : PERM - too many parameters"
- c_error=1
- break
- else if (( ${#line[@]} == 1 )); then
- echo "$line_no : PERM - missing permission"
- c_error=1
- break
- fi
- fi
- # Check if valid permissions are entered
- if [[ ${line[1]} =~ ^[0-9]+$ ]]; then # Check if permission number is used
- if (( ${line[1]} > 7 || ${line[1]} < 0 )); then
- echo "$line_no : Invalid permission number"
- c_error=1
- break
- fi
- else if (( ${#line[1]} != 3 )); then # Check length of string, which should be 3 characters long
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- else if [[ ${line[1]:0:1} == 'r' || ${line[1]:0:1} == '-' ]]; then # Check if the string is valid
- if [[ ${line[1]:1:1} == 'w' || ${line[1]:1:1} == '-' ]]; then
- if ! [[ ${line[1]:2:1} == 'x' || ${line[1]:2:1} == '-' ]]; then
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- fi
- else
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- fi
- else
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- fi
- fi
- fi
- fl_f_list=1
- ;;
- END ) if (( $fl_e == 0 )); then # if previous operand was END, accept
- if (( $fl_o == 0 )); then
- echo "$line_no : Missing RESTRICT before current line"
- c_error=1
- break
- else if [[ $fl_o == 1 ]]; then
- echo "$line_no : Missing PERM before current line"
- c_error=1
- break
- fi
- fi # fl_o = 2 is accepted
- fi
- fl_o=0
- ;;
- * ) if (( $fl_o == 0 )); then
- # After END, only NO/RESTRICT should start the new ACL block
- echo "$line_no : Missing operand"
- c_error=1
- break
- fi
- ;;
- esac
- else
- case ${line[0]} in
- END ) if (( $fl_e == 0 )); then # if previous operand was END, accept
- if (( $fl_o == 0 )); then
- echo "$line_no : Missing RESTRICT before current line"
- c_error=1
- break
- else if [[ $fl_o == 1 ]]; then
- echo "$line_no : Missing PERM before current line"
- c_error=1
- break
- fi
- fi # fl_o = 2 is accepted
- fi
- fl_o=0
- fl_e=1
- # The following flags are used for the whole block
- fl_r_u=0
- fl_r_g=0
- fl_e_u=0
- fl_e_g=0
- fl_no=0
- fl_f_list=0
- ;;
- * ) if (( $fl_o == 0 )); then
- # After END, only NO/RESTRICT should start the new ACL block
- echo "$line_no : Missing operand"
- c_error=1
- break
- else if (( $fl_o == 2 )) && (( ${#line[@]} == 2)); then
- # After PERM, check if addtional permission numer/string exist
- #Check if valid permissions are entered
- if [[ ${line[1]} =~ ^[0-9]+$ ]]; then # Check if permission number is used
- if (( ${line[1]} > 7 || ${line[1]} < 0 )); then
- echo "$line_no : Invalid permission number"
- c_error=1
- break
- fi
- else if (( ${#line[1]} != 3 )); then # Check length of string, which should be 3 characters long
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- else if [[ ${line[1]:0:1} == 'r' || ${line[1]:0:1} == '-' ]]; then
- if [[ ${line[1]:1:1} == 'w' || ${line[1]:1:1} == '-' ]]; then
- if ! [[ ${line[1]:2:1} == 'x' || ${line[1]:2:1} == '-' ]]; then
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- fi
- else
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- fi
- else
- echo "$line_no : Invalid permission string"
- c_error=1
- break
- fi
- fi
- fi
- else if (( $fl_o == 2 ))&& (( ${#line[@]} > 2)); then # too many arguments for permission string/number
- echo "$line_no : Invalid permission string/number"
- fi
- fi
- fi
- ;;
- esac
- fi
- fi
- ((line_no++)) # Line number tracking
- unset line # to reset line array
- done < $config_file
- if (( $fl_o != 0 )) && (( $c_error != 1 )); then
- echo "Missing END before end of file"
- c_error=1
- fi
- echo -n "$c_warn Warning"
- if [[ $c_warn > 1 ]]; then echo 's'; else echo ""; fi
- if [[ $c_error != 1 ]]; then
- echo -e "No config error detected\n"
- else
- exit
- fi
- # Uncomment the exit below to only check config
- #exit
- # Code for setting permissions
- # Note : The below code assumes the config file is perfectly correct
- # The error detection is only handled in above checking code
- # Hence, no debug message from script will be echoed below
- while read line_raw; do
- if [[ ! ($line_raw =~ ^$ || -z $line_raw || $line_raw =~ ^# ) ]]; then # Check if line is empty/null/spaces or starts with #
- a=0
- fl_all=0
- fl_others=0
- line=()
- for word in $line_raw; do
- if [[ $word == \#* || $word == '#' ]]; then # If word starts with #, finish reading (probably is a comment)
- break
- fi
- #echo $word # Uncomment echo $word to see what words this script will actually process
- line[$a]=${word}
- ((a++))
- done
- if (( fl_f_list == 0 )); then
- case ${line[0]} in
- NO ) fl_no=1 # action by default is 'm', if NO is specified, action changes to 'x'
- ;;
- RESTRICT ) if (( $fl_e == 1 )); then
- for (( i=0; i < ${#users[@]}; i++ )); do
- fl_u[$i]=0
- done
- for (( i=0; i < ${#groups[@]}; i++ )); do
- fl_g[$i]=0
- done
- unset d_perm
- fi
- fl_e=0
- case ${line[1]} in
- USER ) if [[ ${line[2]} == "ALL" ]]; then # If ALL is specified, mark all users
- for (( j=0; j < ${#users[@]}; j++ )); do
- fl_u[$j]=1 # Set 1 to mark user will be selected
- done
- else # If not, then mark individual users
- for (( i=2; i < ${#line[@]}; i++ )); do
- for (( j=0; j < ${#users[@]}; j++ )); do
- if [[ ${line[$i]} == ${users[$j]} ]] && !(( ${fl_u[$j]} == 1 )); then
- fl_u[$j]=1 # Set 1 to mark user will be selected
- fi
- done
- done
- fi
- ;;
- GROUP ) if [[ ${line[2]} == "ALL" ]]; then # If ALL is specified, mark all groups
- for (( j=0; j < ${#groups[@]}; j++ )); do
- fl_g[$j]=1 # Set 1 to mark user will be selected
- done
- else # If not, then mark individual groups
- for (( i=2; i < ${#line[@]}; i++ )); do
- for (( j=0; j < ${#groups[@]}; j++ )); do
- if [[ ${line[$i]} == ${groups[$j]} ]] && !(( ${fl_g[$j]} == 1 )); then
- fl_g[$j]=1 # Set 1 to mark user will be selected
- fi
- done
- done
- fi
- ;;
- * ) # I don't expect anything to be here, as this should be blocked during config check
- ;;
- esac
- ;;
- EXCLUDE ) case ${line[1]} in
- USER ) for (( i=2; i < ${#line[@]}; i++ )); do # Mark individual users
- for (( j=0; j < ${#users[@]}; j++ )); do
- if [[ ${line[$i]} == ${users[$j]} ]] && !(( ${fl_u[$j]} == 0 )); then
- fl_u[$j]=0 # Set 0 to mark user will not be selected
- fi
- done
- done
- ;;
- GROUP ) for (( i=2; i < ${#line[@]}; i++ )); do # Mark individual groups
- for (( j=0; j < ${#groups[@]}; j++ )); do
- if [[ ${line[$i]} == ${groups[$j]} ]] && !(( ${fl_g[$j]} == 0 )); then
- fl_g[$j]=0 # Set 0 to mark group will not be selected
- fi
- done
- done
- ;;
- * ) # I don't expect anything to be here, as this should be blocked during config check
- ;;
- esac
- ;;
- PERM ) d_perm=${line[1]} # Default permission of current ACL block, can be number or string
- fl_f_list=1
- ;;
- END ) # Process file list, line by line
- if (( ${#line[@]} == 1 )); then # No individual permission specified, follow default permission
- a_perm=$d_perm # Actual permission = default permission
- else
- # else implies ${#line[@]} == 2, but since checking was done already,no extra if statements
- a_perm=${line[1]} # Actual permission = individual option
- fi
- for (( i=0; i < ${#users[@]}; i++ )); do # Check if user is marked to be processed
- if (( ${fl_u[$i]} == 1 )); then
- if (( $fl_no_b == 0 )); then
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -m u:${users[$i]}:$a_perm ${line[0]}"
- else
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -x u:${users[$i]} ${line[0]}"
- fi
- fi
- done
- for (( i=0; i < ${#groups[@]}; i++ )); do # Check if group is marked to be processed
- if (( ${fl_g[$i]} == 1 )); then
- if (( $fl_no_b == 0 )); then
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -m g:${groups[$i]}:$a_perm ${line[0]}"
- else
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -x g:${groups[$i]} ${line[0]}"
- fi
- fi
- done
- ;;
- esac
- else
- case ${line[0]} in
- END ) # Reset flags
- # Since for setting permissions, the script handles ACl block by block,
- # some flags are reseted after each block, rather than each line
- fl_no_b=$fl_no
- fl_no=0
- fl_f_list=0
- fl_e=1
- ;;
- * ) # Process file list, line by line
- if (( ${#line[@]} == 1 )); then # No individual permission specified, follow default permission
- a_perm=$d_perm # Actual permission = default permission
- else
- # else implies ${#line[@]} == 2, but since checking was done already,no extra if statements
- a_perm=${line[1]} # Actual permission = individual option
- fi
- for (( i=0; i < ${#users[@]}; i++ )); do # Check if user is marked to be processed
- if (( ${fl_u[$i]} == 1 )); then
- if (( $fl_no == 0 )); then
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -m u:${users[$i]}:$a_perm ${line[0]}"
- else
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -x u:${users[$i]} ${line[0]}"
- fi
- fi
- done
- for (( i=0; i < ${#groups[@]}; i++ )); do # Check if group is marked to be processed
- if (( ${fl_g[$i]} == 1 )); then
- if (( $fl_no == 0 )); then
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -m g:${groups[$i]}:$a_perm ${line[0]}"
- else
- # Remove echo "" from below to actually execute setfacl
- echo "setfacl -x g:${groups[$i]} ${line[0]}"
- fi
- fi
- done
- ;;
- esac
- fi
- fi
- unset line # to reset line array
- done < $config_file
Advertisement
Add Comment
Please, Sign In to add comment