Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the primary group ID assigned to the user be the same as the user ID?

Tags:

linux

unix

I've noticed something odd in my file permissions schema. The user id is 500 but the primary group set to the user is also 500 (same as user ID). Is this allowed? I am running into permission problems on my apache server and am wondering if this is related. I don't see a group that exists with a user id of "500" in etc/groups. When i run 'cat etc/passwd', the user with the id of 500 has 500 for the group as well .. but that group doesn't exist. But if it didn't exist, wouldn't an error be thrown when it was originally created?

The specific server errors I am encountering (in apache) are definitely unix permission related:

[Fri Nov 01 11:25:44 2013] [error] SoftException in Application.cpp:256: File "/home/sagedev/directory_name/index.php" is writeable by group

like image 303
Chris Scott Avatar asked Sep 16 '25 10:09

Chris Scott


1 Answers

uid and gid are separate namespaces. It's perfectly reasonable to have a user 500 who belongs to group 500, or a user 500 that belongs to group 501 while user 501 belongs to group 500, or a user 500 and a group 500 that have nothing to do with each other.

Files with nonexistent group ownership are not good though, and users with a nonexistent gid in the passwd file are definitely not good. You need to find out how they got that way. Did you delete the group that used to have gid 500?

Run these commands:

pwck
grpck

to check for other inconsistencies in your passwd file, and this one:

find /home \( -nouser -o -nogroup \) -print

to search for files with nonexistent owners/groups.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!