On Linux systems, /etc/passwd file contains an UID and a GID per user. GID represents the ID of the primary group of the user.
But we can also set additional groups to a user with /etc/group file.
Is there a difference between primary and additional groups for a user ?
Let's take 2 examples:
- Example 1:
/etc/passwd:
test:x:1000:151:test,,,:/home/test:/bin/bash
/etc/group
group1:x:151:
group2:x:152:test
group3:x:153:
In this example, test is member of group1 (as main group because his gid is 151) and group2.
- Example 2:
/etc/passwd:
test:x:1000:152:test,,,:/home/test:/bin/bash
/etc/group
group1:x:151:test
group2:x:152:
group3:x:153:
In this example, test is member of group1 and group2 (as main group because his gid is 152).
Is there a difference in effective user permissions between this 2 examples ?
Thanks