<HTML ><HEAD ><TITLE >Verifying the NIS/NYS Installation </TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="The Linux NIS(YP)/NYS/NIS+ HOWTO" HREF="index.html"><LINK REL="PREVIOUS" TITLE="Setting up a NIS Server " HREF="ypserv.html"><LINK REL="NEXT" TITLE="Creating and Updating NIS maps " HREF="maps.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >The Linux NIS(YP)/NYS/NIS+ HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="ypserv.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="maps.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="VERIFICATION" ></A >10. Verifying the NIS/NYS Installation </H1 ><P >If everything is fine (as it should be), you should be able to verify your installation with a few simple commands. Assuming, for example, your passwd file is being supplied by NIS, the command</P ><P > <TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" > % ypcat passwd</PRE ></FONT ></TD ></TR ></TABLE > </P ><P >should give you the contents of your NIS passwd file. The command</P ><P > <TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" > % ypmatch userid passwd</PRE ></FONT ></TD ></TR ></TABLE > </P ><P >(where userid is the login name of an arbitrary user) should give you the user's entry in the NIS passwd file. The "ypcat" and "ypmatch" programs should be included with your distribution of traditional NIS or NYS.</P ><P >If a user cannot log in, run the following program on the client: <TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" >#include <stdio.h> #include <pwd.h> #include <sys/types.h> int main(int argc, char *argv[]) { struct passwd *pwd; if(argc != 2) { fprintf(stderr,"Usage: getwpnam username\n"); exit(1); } pwd=getpwnam(argv[1]); if(pwd != NULL) { printf("name.....: [%s]\n",pwd->pw_name); printf("password.: [%s]\n",pwd->pw_passwd); printf("user id..: [%d]\n", pwd->pw_uid); printf("group id.: [%d]\n",pwd->pw_gid); printf("gecos....: [%s]\n",pwd->pw_gecos); printf("directory: [%s]\n",pwd->pw_dir); printf("shell....: [%s]\n",pwd->pw_shell); } else fprintf(stderr,"User \"%s\" not found!\n",argv[1]); exit(0); }</PRE ></FONT ></TD ></TR ></TABLE > </P ><P >Running this program with the username as parameter will print all the information the getpwnam function gives back for this user. This should show you which entry is incorrect. The most common problem is, that the password field is overwritten with a "*".</P ><P >GNU C Library 2.1 (glibc 2.1) comes with a tool called getent. Use this program instead the above on such a system. You could try: <TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" > getent passwd</PRE ></FONT ></TD ></TR ></TABLE > or <TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" > getent passwd login</PRE ></FONT ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="ypserv.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="maps.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Setting up a NIS Server </TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Creating and Updating NIS maps </TD ></TR ></TABLE ></DIV ></BODY ></HTML >