old-www/HOWTO/NIS-HOWTO/verification.html

281 lines
4.3 KiB
HTML

<HTML
><HEAD
><TITLE
>Verifying the NIS/NYS Installation
&#13;</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
&#13;</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
>&#13;<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> % ypcat passwd</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</P
><P
>should give you the contents of your NIS passwd file. The command</P
><P
>&#13;<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> % ypmatch userid passwd</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</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 &#60;stdio.h&#62;
#include &#60;pwd.h&#62;
#include &#60;sys/types.h&#62;
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-&#62;pw_name);
printf("password.: [%s]\n",pwd-&#62;pw_passwd);
printf("user id..: [%d]\n", pwd-&#62;pw_uid);
printf("group id.: [%d]\n",pwd-&#62;pw_gid);
printf("gecos....: [%s]\n",pwd-&#62;pw_gecos);
printf("directory: [%s]\n",pwd-&#62;pw_dir);
printf("shell....: [%s]\n",pwd-&#62;pw_shell);
}
else
fprintf(stderr,"User \"%s\" not found!\n",argv[1]);
exit(0);
}</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</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
>&#13;</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&#13;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Creating and Updating NIS maps&#13;</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>