Illusionist
Illusionist

Reputation: 5489

Linux user permissions folder for multiple users

I have to give user jenkins permission to /home/ec2-user/.local/lib/python3.8/site-packages. I can not do chmod 777 -R /home/ec2-user/.local/lib/python3.8/site-packages because the ssh keys are in /home/ec2-user/.ssh. I tried using

setfacl -m u:jenkins:rwx /home/ec2-user/.local/lib/python3.8/site-packages

and I did not get any errors, but Jenkins still gets permission denied.

Upvotes: 0

Views: 88

Answers (1)

ceving
ceving

Reputation: 23774

You can use the following function to check the access to all path elements.

pathex ()
{
  local p
  local a
  if [ -x "$1" ]
  then
    a=access
  else
    a='NO ACCESS'
  fi
  printf "%s: \t%s\n" "$a" "$1"
  p="$(dirname "$1")"
  if [ "$p" != "$1" ]
  then
    pathex "$p"
  fi
}

Esample usage:

$ pathex /var/log/syslog
NO ACCESS:      /var/log/syslog
access:         /var/log
access:         /var
access:         /

Upvotes: 2

Related Questions