命令cat / etc / group& amp;团体和getent group

时间:2018-03-05 21:43:56

标签: unix

我是unix用户的新手,并且想知道unix中存储了所有组的位置。我的印象是他们将在/etc/group文件中更新,但是当我读取该文件时,它并不具备所有内容。而getent group命令显示每个组中的所有组和关联用户。

我知道每个用户都有一个主要组,它将存储在/etc/passwd(通常在字段4中),并且可能有一个或多个补充组。只有补充组协会在/etc/group

所以,这是我的问题。

  1. 我是否认为所有群组都会存储在/etc/group

  2. 如果是这样,这三个命令之间有什么区别

     一个。 cat /etc/group
     湾groups
     C。 getent group

  3. 为什么在使用getent groups命令而不是cat /etc/group时能够看到更多群组?

  4. 请告诉我。

1 个答案:

答案 0 :(得分:4)

getent/etc/groups读取以及为您的系统配置的任何其他数据库源。对于Solaris系统,它存储在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

对于Linux系统,请查看/etc/nsswitch.conf

相关问题