I notice that getent passwd is alot slower than ypcat. So I was wondering why that is? Is ypcat reading from a cache and getent isn't? I am not sure. Anyone know the answer to this?
I actually found the answer for using ypmatch and solaris, but the jist is the same.
On a Solaris machine, you can use the command getent to look up NIS entries, as follows: %% getent mapname entry (opposite order of ypmatch) For example: %% getent root passwd The difference between ypmatch and getent is that ypmatch only looks up entries in the NIS maps, while getent consults the nsswitch.conf file, and then looks up the query according to that order. For example, if nsswitch.conf reads as follows: passwd: files nis The above getent would first have looked at the /etc/passwd file, then the NIS passwd map. Essentially, getent should do exactly the same lookup as any normal program would. If you find that you have to troubleshoot something specific in your NIS database you should use the yp commands instead to make sure you dont get the information from your local files or DNS. getent is only documented as able to consult passwd and groups. However, you may be able to getent hosts and other databases on newer OS'es.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.