Reputation: 217
I am a novice Unix user and was wondering where all the groups are stored in Unix. I thought that they would be updated in /etc/group
file but when I read that file it does not have everything. Whereas, getent group
command displays all the groups and associated users in each group.
I am aware that each user has a primary group, which will be stored in /etc/passwd
(usually in field 4), and may have one or more supplementary groups. Only the supplementary group associations are in /etc/group
So, here are my questions.
Am I under the wrong impression that all groups are stored in /etc/group
?
If so, what is the difference between these three commands
a. cat /etc/group
b. groups
c. getent group
Why am I able to see more groups when I use the command getent groups
than cat /etc/group
?
Please let me know.
Upvotes: 2
Views: 2145
Reputation: 2576
getent
reads from /etc/groups
and whatever other database sources are configured for your system. For a Solaris system, this is stored in SMF:
$ svcprop -p config name-service/switch
config/automount astring files\ ldap
config/default astring files
config/group astring files\ ldap
config/host astring files\ dns
config/netgroup astring ldap
config/password astring files\ ldap
config/value_authorization astring solaris.smf.value.name-service.switch
For a linux system, have a look at /etc/nsswitch.conf
Upvotes: 6