This post describes how to identify Network Information Service (NIS) authenticated users.
1. To obtain a complete list of all NIS users, run the ypcat passwd command For example:
[root@nisserver ~]# ypcat passwd test2:x:504:504::/home/test2:/bin/bash user1:x:501:501::/home/user1:/bin/bash user2:x:502:502::/home/user2:/bin/bash user3:x:503:503::/home/user3:/bin/bash
2. To identify whether a specific user is a NIS user, run the ypmatch [username] passwd command.
– If the given user exists within the NIS database, expect output such as the following:
[root@nisserver ~]# ypmatch user1 passwd user1:x:501:501::/home/user1:/bin/bash
– If the user does not exist within the NIS database, expect output such as the following:
[root@nisserv ~]# ypmatch test passwd Can't match key test in map passwd.byname. Reason: No such key in map
Note: It is recommended and common practice, to have the user root (with the numerical UID=0) always and only stored in the local files /etc/passwd and /etc/shadow. A user with the name root and/or the numerical uid=0 should never be stored in NIS.