Reputation: 39
I have some questions about getent group
.
getent group A
get the information on group A?/etc/group
?getent group A
while I can not find the user from group A in /etc/group
? If yes, how could this happen?The third one is actually the problem I met.
Example:
1st. [root@*** test]# getent group A | grep A
2nd. [root@*** test]# cat $INSTALLROOT/etc/group | grep A
I can find a user a
from the first command while I cannot find the user a
from the second command.
Upvotes: 2
Views: 3222
Reputation:
Where does "getent group A" get the information on group A?
It is configured in /etc/nsswitch.conf
. man getent
tells this.
Does it only get from /etc/group?
It depends on your config files. On my machine it does not get this information only from /etc/group since it is configured in this way:
group: files ldap
is it possible that i can find a user (belong group A) by "getent group A" while can NOT find the user from group A in /etc/group?
Yes it is possible if there are at least two sources of data for groups.
By the way, take a look at how getent group
work - run it under strace.
strace -s 256 -o getent.strace.txt -v getent group
And see what system calls it does. In my case it first reade from /etc/group and loads an ldap module and starts reading from socket
Upvotes: 3