Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
119
rated 0 times [  119] [ 0]  / answers: 1 / hits: 119186  / 1 Year ago, tue, november 15, 2022, 9:54:50

I have a ext4 partition and I've set the group owner for all subdirectors to mygroup:



# chgrp -R mygroup /mount/abc
# chmod -R g+swrx /mount/abc


My user is part of that group. Inside that partition is a folder who is owned by user 'nobody' and now by the group 'mygroup'. My user is part of 'mygroup'. Here's an ls -l:



myuser@host:/mount/abc/folder$ ls -l
drwxr-sr-x 2 nobody mygroup 4096 Apr 25 12:08 ./
drwxrwsrwx 6 nobody mygroup 4096 Apr 24 07:57 ../
-rw-r-xr-- 1 otheruser mygroup 159539 Apr 23 23:44 test.png*

myuser@host:/mount/abc/folder$ groups myuser
myuser : mygroup {... a list of other groups also...}

myuser@host:/mount/abc/folder$ rm test.png
rm: remove write-protected regular file ‘test.png’? y
rm: cannot remove ‘test.png’: Permission denied

myuser@host:/mount/abc/folder$ touch test.txt
touch: cannot touch ‘test.txt’: Permission denied


Note that I cannot delete nor create a file that is owned by a group that my user is a part of.



I guess I don't fully understand how groups work. I thought if you were part of a group then you inherit the permissions of that group. Am I doing something wrong?



Thanks


More From » 12.04

 Answers
0

Did you recently add that user to that group, without logging out/in between? Then "groups" will show the group but the user does not have the group permissions yet.



You can show your effective groups using



$ id


As an example, if I add my user ps to the group fax and then type



$ id


it does not show the group fax, but



$ groups ps


shows fax.



Doing su to your own user gives you the new group affiliation:



$ su ps
$ id


The output now also contains fax.


[#25682] Thursday, November 17, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingssex

Total Points: 21
Total Questions: 122
Total Answers: 98

Location: Sweden
Member since Fri, Mar 26, 2021
3 Years ago
;