I have directory /home/git/repositories
with rights 770 and uid=git,gid=git
user1@gitserver:~$ ls -la /home/git/ | grep repo
drwxrws--- 42 git git 4096 Jun 30 17:02 repositories
I have user 'www-data', which added into 'git' group
user1@gitserver:~$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data),1001(git)
user1@gitserver:~$ id -G www-data
33 1001
From 'www-data' user running python-script which calling os.listdir('/home/git/repositories')
and failing with message
OSError: [Errno 13] Permission denied: '/home/git/repositories/'
def functn()
repo_dir = '/home/git/repositories'
logg('CURRENT USER: getresuid && getresgid')
logg(os.getresuid())
logg(os.getresgid())
logg('CURRENT USER: getgroups')
logg(os.getgroups())
logg(os.listdir(repo_dir)) <-- here is fault
Here is output:
'CURRENT USER: getresuid && getresgid'
(33, 33, 33)
(33, 33, 33)
'CURRENT USER: getgroups'
[33] <-- 'git' group not showing =(
User 'www-data' added to git group. Why he cant list that directory?!
upd here is namei -mo /home/git/repositories:
user1@gitserver:~$ namei -mo /home/git/repositories
f: /home/git/repositories
drwxr-xr-x root root /
drwxr-xr-x root root home
drwxr-xr-x git git git
drwxrws--- git git repositories
/home/git
also matter. Add the output ofnamei -mo /home/git/repositories
to your question. Also, you may need to restart the web server process for new group memberships to take effect. – muru Jul 16 at 3:12user1@gitserver:~$ id -G www-data
say:33 1001
butuser1@gitserver:~$ id -g www-data
say:33
So, it mean that effective groups not contain 'git'. Is restart web-server can help me? Or i should reboot computer? – user28828 Jul 16 at 3:29www-data
to the new group, it think won't be affected. If you can restart just the web server, try it. – muru Jul 16 at 3:35