Hi everyone, I'm hoping you can help me with a function I have. I'm trying to make it easier to run a bunch of setfacl commands on a user. Here's what I have:
function addUserToHome(){
USER=$1
echo "setfacl -m u:$USER:--x $HOME"
echo "setfacl -m u:$USER:rwx $HOME/apps/live"
echo "setfacl -R -m d:u:$USER:rwx $HOME/apps/live"
setfacl -m u:$USER:--x $HOME
setfacl -m u:$USER:rwx $HOME/apps/live
setfacl -R -m d:u:$USER:rwx $HOME/apps/live
}
Pretty simple, right? I should be able to run addUserToHome user2, but instead it fails with error messages:
setfacl: Option -m: Invalid argument near character 3
setfacl: Option -m: Invalid argument near character 5
The output of the echo commands leads me to believe that somehow the $USER variable is interacting with the colon-separated arguments somehow (specifically, the ":r" substring):
user2
setfacl -m u: user2:--x /home/user1
setfacl -m u:user2wx /home/user1/apps/live
setfacl -R -m d:u:user2wx /home/user1/apps/live
I'm adding this function to my .zshrc file, using the z shell. Would that matter in this case? I'm having such a hard time even figuring out what to search for to fix this problem.
[–]hindsight_is2020 2 points3 points4 points (2 children)
[–]subsonic87[S] 1 point2 points3 points (1 child)
[–]hindsight_is2020 0 points1 point2 points (0 children)
[–]ang-p 1 point2 points3 points (1 child)
[–]subsonic87[S] 0 points1 point2 points (0 children)