Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the difference between ypcat and getent passwd

Status
Not open for further replies.

clonny2

MIS
Jan 28, 2003
470
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top