0

I am trying to access a directory test as user ayush. This directory is owned by user ayush and has group git The directory has permissions 0070, and group git, and ayush is a member of that group.

ayush:~> ls -ld
drwxr-xr-x 7 ayush git 4096 Feb 15 11:33 .
ayush:~> ls
test
ayush:~> ls -ld test/
drwxrwx--- 3 ayush git 4096 Feb 15 11:34 test/
ayush:~> chmod 070 test/ 
ayush:~> ls -ld test/
d---rwx--- 3 ayush git 4096 Feb 15 11:34 test/
ayush:~> ls -l test/ 
ls: cannot open directory test/: Permission denied
ayush:~> groups
git
ayush:~> id
uid=11417(ayush) gid=30(git) groups=30(git)

I have been seeing this error for a while now and it was not there before. This is not a new group and I have using it in some of my code here and there.

BTW, I switched to another user who is also part of this group who was able to access "test" directory without any issues.

EDIT 1: Its not just this, I am unable to change the group of the folder "test" with 770 permissions. I am getting an "operation not permitted" error. And, I am facing this issue with only the group "git". I am able to switch the group of the folder to another group of which I am a member of. But then I am not able to switch back the user to "git".

  • I don't really understand what you're doing in your EDIT 1 text. Could you show with examples? – Kusalananda Feb 16 at 19:37
3

Since you're the owner of the file, "user" permissions apply.

Group permissions only apply if you're not the owner.

Similarly, "other" permissions only apply if you're not the owner and not in the group.

The one difference is the root user, who can read files even if permissions say otherwise :-)

  • The exception is any process with capability CAP_DAC_OVERRIDE, by default root has all capabilities. – ctrl-alt-delor Feb 16 at 16:00
  • Hi. I have edited the question and added the last line. Can you please check that out as well? Thanks. – Ayu Feb 16 at 19:00
0

I found the issue. I have a cap of 16 groups and I had added my user to 17 groups. The "git" group was listed as the last and hence I wasn't counted as a member of it when doing group operations as only the first 16 groups were considered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.