home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / OTHER_FO / SGML / NIS_HOWT.GZ / NIS-HOWTO.sgml
Encoding:
SGML Document  |  1996-02-11  |  26.5 KB  |  779 lines

  1. <!doctype linuxdoc system>
  2.  
  3. <article>
  4.  
  5. <title>The Linux NIS(YP)/NIS+/NYS HOWTO
  6. <author>Andrea Dell'Amico, Mitchum DSouza, Erwin Embsen, Peter Eriksson
  7. <date>v0.5, 24 January 1995
  8.  
  9. <toc>
  10.  
  11. <sect>Glossary of Terms
  12.  
  13. <p>
  14. In this document a lot of acronyms are used. Here are the most
  15. important acronyms and a brief explanation:
  16.  
  17. <descrip>
  18. <tag/DBM/DataBase Management, a library of functions which
  19.     maintain key-content pairs in a data base.
  20.  
  21. <tag/DLL/Dynamically Linked Library, a library linked to an
  22.     executable program at run-time.
  23.  
  24. <tag/domainname/A name "key" that is used by NIS clients to be
  25.     able to locate a suitable NIS server that serves that
  26.     domainname key. Please note that this does not necessarily
  27.     have anything at all to do with the DNS "domain"
  28.     (machine name) of the machine(s).
  29.  
  30. <tag/FTP/File Transfer Protocol, a protocol used to transfer
  31.     files between two computers.
  32.  
  33. <tag/libnsl/Name services library, a library of name service calls
  34.     (getpwnam, getservbyname, etc...) on SVR4 Unixes.
  35.  
  36. <tag/libsocket/Socket services library, a library for the socket
  37.     service calls (socket, bind, listen, etc...) on SVR4 Unixes.
  38.  
  39. <tag/NIS/Network Information Service, a service that provides
  40.     information, that has to be known throughout the network,
  41.     to all machines on the network. There is support for NIS
  42.     in Linux's standard libc library, which in the following text
  43.     is referred to as "traditional NIS".
  44.  
  45. <tag/NIS+/Network Information Service (Plus :-), essentially NIS on
  46.     steroids. NIS+ is designed by Sun Microsystems Inc. as a
  47.     replacement for NIS with better security and better handling
  48.     of _large_ installations.
  49.  
  50. <tag/NYS/This is the name of a project and stands for NIS+, YP and Switch
  51.     and is managed by Peter Eriksson <pen@lysator.liu.se>. It contains
  52.     among other things a complete reimplementation of the NIS (=YP) code
  53.     that uses the Name Services Switch functionality of the NYS library.
  54.  
  55. <tag/RPC/Remote Procedure Call. RPC routines allow C programs to
  56.     make procedure calls on other machines across the network.
  57.     When people talk about RPC they most often mean the SunRPC
  58.     variant.
  59.  
  60. <tag/YP/Yellow Pages(tm), a registered trademark in the UK of
  61.     British Telecom plc.
  62.  
  63. <tag/TCP-IP/Transmission Control Protocol/Internet Protocol. It's a
  64.     data communication protocol often used on Unix machines.
  65. </descrip>
  66.  
  67.  
  68. <sect1>Some General Information
  69.  
  70. <p>
  71. The next three lines are quoted from the Sun(tm) System & Network
  72. Administration Manual:
  73.  
  74. <tscreen><verb>
  75.     "NIS was formerly known as Sun Yellow Pages (YP) but
  76.      the name Yellow Pages(tm) is a registered trademark
  77.      in the United Kingdom of British Telecom plc and may
  78.      not be used without permission."
  79. </verb></tscreen>
  80.  
  81. NIS stands for Network Information Service. It's purpose is to
  82. provide information, that has to be known throughout the network,
  83. to all machines on the network. Information likely to be
  84. distributed by NIS is:
  85.  
  86. <itemize>
  87. <item>login names/passwords/home directories (/etc/passwd)
  88. <item>group information (/etc/group)
  89. </itemize>
  90.  
  91. So, for example, if your password entry is recorded in the NIS
  92. passwd database, you will be able to login on all machines on the
  93. net which have the NIS client programs running.
  94.  
  95. Sun is a trademark of Sun Microsystems, Inc. licensed to
  96. SunSoft, Inc.
  97.  
  98.  
  99. <sect>Introduction
  100.  
  101. <p>
  102. More and more, Linux machines are installed as part of a network of
  103. computers. To simplify network administration, most networks (mostly
  104. Sun-based networks) run the Network Information Service. Linux machines
  105. can take full advantage of existing NIS service or provide NIS service
  106. themselves. It can also (with the NYS library) act as a limited NIS+
  107. client.
  108.  
  109. This document tries to answer questions about setting up NIS(YP) on
  110. your Linux machine. It does not talk about how to set up NIS+. Don't
  111. forget to read section 5.1, The RPC Portmapper.
  112.  
  113.  
  114. <sect1>New versions of this document
  115.  
  116. <p>
  117. New versions of this document will be posted periodically (about every
  118. month) to the newsgroups comp.os.linux.announce and comp.os.linux.misc.
  119. The document is archived on a number of Linux FTP sites, including
  120. <tt>sunsite.unc.edu</tt> in <tt>/pub/Linux/docs/HOWTO</tt>.
  121.  
  122.  
  123. <sect1>Disclaimer
  124.  
  125. <p>
  126. Although this document has been put together to the best of our
  127. knowledge it may, and probably does contain errors. Please read any
  128. README files that are bundled with any of the various pieces of
  129. software described in this document for more detailed and accurate
  130. information. We will attempt to keep this document as error free as
  131. possible.
  132.  
  133.  
  134. <sect1>Feedback
  135.  
  136. <p>
  137. If you have any comments, questions or suggestions please email
  138. them to <tt>Erwin Embsen <erwin@nioz.nl></tt>. Definitely contact
  139. him if you find errors or obvious omissions.
  140.  
  141.  
  142. <sect1>Acknowledgements
  143.  
  144. <p>
  145. We would like to thank all the people who have contributed (directly
  146. or indirectly) to this document. In alphabetical order:
  147.  
  148. <tscreen><verb>
  149. Andrea Dell'Amico <adellam@di.unipi.it>
  150. Mitchum DSouza    <Mitch.Dsouza@Dubai.Sun.COM>
  151. Erwin Embsen      <erwin@nioz.nl>
  152. Byron A Jeff      <byron@cc.gatech.edu>
  153. Peter Eriksson    <pen@lysator.liu.se>
  154. </verb></tscreen>
  155.  
  156. Theo de Raadt <deraadt@fsa.ca> is responsible for the original
  157. yp-clients code.  Swen Thuemmler <swen@uni-paderborn.de> ported the
  158. yp-clients code to Linux and also ported the yp-routines in libc
  159. (again based on Theo's work).
  160.  
  161.  
  162. <sect>NIS or NIS+ ?
  163.  
  164. <p>
  165. The choice between NIS and NIS+ is easy - use NIS if you don't have to
  166. use NIS+ or have severe security needs. NIS+ is _much_ more problematic
  167. to administer (it's pretty easy to handle on the client side, but the
  168. server side is horrible). Another problem is that the support for NIS+
  169. under Linux is still under developement - one major thing it still
  170. lacks is support for data encryption/authentication which is _the_
  171. major thing why anyone would want to use NIS+...
  172.  
  173.  
  174. <sect1>Traditional NIS or the NYS library ?
  175.  
  176. <p>
  177. The choice between Traditional NIS or the NIS code in the NYS library
  178. is a choice between laziness and maturity vs. flexibility and love of
  179. adventure.
  180.  
  181. The "traditional NIS" code is in the standard C library and has been
  182. around longer and sometimes suffers from it's age and slight
  183. inflexibility.
  184.  
  185. The NIS code in the NYS library, on the other hand requires you either
  186. to recompile and relink all your programs to the libnsl library, or
  187. recompile the libc library to include the libnsl code into the libc
  188. library (or maybe you can go get a precompiled version of libc from
  189. someone who has already done it).
  190.  
  191. Another difference is that the traditional NIS code has some support
  192. for NIS Netgroups, which the NYS code doesn't (yet). On the other hand
  193. the NYS code allows you to handle Shadow Passwords in a transparent
  194. way.
  195.  
  196.  
  197. <sect>How it works
  198.  
  199. <p>
  200. Within a network there must be at least one machine acting as a NIS
  201. server. You can have multiple NIS servers, each serving different NIS
  202. "domains" - or you can have cooperating NIS servers, where one is said
  203. to be the master NIS server, and all the other are so-called slave NIS
  204. servers (for a certain NIS "domain", that is!) - or you can have a mix
  205. of them...
  206.  
  207. Slave servers only have copies of the NIS databases and receive these
  208. copies from the master NIS server whenever changes are made to the
  209. master's databases.  Depending on the number of machines in your
  210. network and the reliability of your network, you might decide to
  211. install one or more slave servers.  Whenever a NIS server goes down or
  212. is too slow in responding to requests, a NIS client connected to that
  213. server will try to find one that is up or quicker.
  214.  
  215. NIS databases are in so-called DBM format, derived from ASCII
  216. databases.  For example, the files <tt>/etc/passwd</tt> and
  217. <tt>/etc/group</tt> can be directly converted to DBM format using
  218. ASCII-to-DBM translation software ("dbload", it's included with the
  219. server software). The master NIS server should have both, the ASCII
  220. databases and the DBM databases.
  221.  
  222. Slave servers  will be notified of any change to the NIS maps, (via the
  223. "yppush" program), and automatically retrieve the necessary changes in
  224. order to synchronize their databases. NIS clients does not need to do
  225. this since they always talks to the NIS server to read the information
  226. stored in it's DBM databases.
  227.  
  228. The author of the YP clients for linux has informed us that the newest
  229. ypbind (from yp-clients.tar.gz) is able to get the server from a
  230. configuration file - thus no need to broadcast (which is insecure - due
  231. to the fact that anyone may install a NIS server and answer the
  232. broadcast queries...)
  233.  
  234.  
  235.  
  236. <sect>What do you need to set up NIS?
  237.  
  238. <sect1>The RPC Portmapper
  239.  
  240. <p>
  241. To run any of the software mentioned below you will need to run the
  242. program /usr/sbin/rpc.portmap. Some Linux distributions already have
  243. the code in /etc/rc.d/rc.inet2 to start up this daemon.  All you have
  244. to do is comment it out and reboot your Linux machine to activate it.
  245.  
  246. The RPC portmapper (portmap(8c)) is a server that converts RPC program
  247. numbers into TCP/IP (or UDP/IP) protocol port numbers. It must be
  248. running in order to make RPC calls (which is what the NIS client
  249. software does) to RPC servers (like a NIS server) on that machine.
  250. When an RPC server is started, it will tell portmap what port number it
  251. is listening to, and what RPC program numbers it is prepared to serve.
  252. When a client wishes to make an RPC call to a given program number, it
  253. will first contact portmap on the server machine to determine the port
  254. number where RPC packets should be sent.
  255.  
  256. Normally, standard RPC servers are started by inetd(8C), so portmap
  257. must be started before inetd is invoked.
  258.  
  259.  
  260. <sect1>Determine whether you are a Server, Slave or Client.
  261.  
  262. <p>
  263. To answer this question you have to consider two cases:
  264.  
  265. <enum>
  266. <item>Your machine is going to be part of a network with existing NIS servers
  267. <item>You do not have any NIS servers in the network yet
  268. </enum>
  269.  
  270. In the first case, you only need the client programs (ypbind, ypwhich,
  271. ypcat, yppoll, ypmatch). The most important program is ypbind. This
  272. program must be running at all times, that is, it should always appear
  273. in the list of processes. It's a so-called daemon process and needs to
  274. be started from the system's startup file (eg. /etc/rc.local).
  275. As soon as ypbind is running, your system has become a NIS client.
  276.  
  277. In the second case, if you don't have NIS servers, then you will also
  278. need a NIS server program (usually called ypserv). Section 6 describes
  279. how to set up a NIS server on your Linux machine using the "ypserv"
  280. implementation by Peter Eriksson (<tt><pen@lysator.liu.se></tt>). Note
  281. that this implementation does NOT support the master-slave concept
  282. talked about in section 3. Using this software, all your NIS servers
  283. will be master servers. There is also another free NIS server
  284. available, called "yps", written by Tobias Reber in Germany which does
  285. support the master-slave concept, but has other limitations.
  286.  
  287.  
  288. <sect1>The Software
  289.  
  290. <p>
  291. The system library "/usr/lib/libc.a" (version 4.4.2 and better) or the
  292. shared library "/usr/lib/libc.sa" and its related DLL contain all
  293. necessary system calls to succesfully compile the NIS client and server
  294. software.
  295.  
  296. Some people reported that NIS only works with "/usr/lib/libc.a" version
  297. 4.5.21 and better so if you want to play it safe don't user older
  298. libc's.  The NIS client software can be obtained from:
  299.  
  300. <tscreen><verb>
  301.   Site                   Directory                        File Name
  302.   
  303.   ftp.uni-paderborn.de   /pcsoft2/linux/local/yp          yp-clients.tar.gz
  304.   ftp.funet.fi           /pub/OS/Linux/BETA/NYS/clients   yp-clients.tar.gz
  305.   ftp.lysator.liu.se     /pub/NYS/clients                 yp-clients.tar.gz
  306.   sunsite.unc.edu        /pub/Linux/system/Network/admin  yp-clients.tar.gz
  307. </verb></tscreen>
  308.  
  309. Once you obtained the software, please follow the instructions which
  310. come with the software.
  311.  
  312.  
  313. <sect1>Setting up a NIS Client using Traditional NIS
  314.  
  315. <p>
  316. Assuming you have succesfully compiled the software you are now ready
  317. to install the software. A suitable place for the ypbind daemon is
  318. the directory /usr/sbin.
  319.  
  320. You'll need to do this as root of course. The other binaries (ypwhich,
  321. ypcat, yppoll, ypmatch) should go in a directory accessible by all
  322. users, for example /usr/etc or /usr/local/bin.  It might be a good idea
  323. to test ypbind before incorporating it in /etc/rc.d/rc.inet2.
  324.  
  325. To test ypbind do the following:
  326.  
  327. <itemize>
  328. <item>Make sure you have your domain name set. If it is not set then
  329.     issue the command:
  330.  
  331.     <tscreen><verb>
  332.         /bin/domainname-yp nis.domain
  333.     </verb></tscreen>
  334.  
  335.     where <tt>nis.domain</tt> should be some string, _NOT_ normally
  336.     associated with the domain name of your machine! The reason for
  337.     this is that it makes it a little harder for external crackers
  338.     to retreive the password database from your NIS servers. If you
  339.     don't know what the NIS domain name is on your network, ask
  340.     your system/network administrator.
  341.  
  342. <item>Start up "/usr/sbin/rpc.portmap" if it is not already running.
  343.  
  344. <item>Create the directory "/var/yp" if it does not exist.
  345.  
  346. <item>Start up "/usr/sbin/ypbind"
  347.  
  348. <item>Use the command "rpcinfo -p localhost" to check if ypbind
  349.       was able to register its service with the portmapper. The
  350.       rpcinfo should produce something like:
  351.  
  352.       <tscreen><verb>
  353.        program vers proto   port
  354.         100000    2   tcp    111  portmapper
  355.         100000    2   udp    111  portmapper
  356.         100007    2   udp    637  ypbind
  357.         100007    2   tcp    639  ypbind
  358.         300019    1   udp    660
  359.       </verb></tscreen>
  360.  
  361. <item>You may also run "rpcinfo -u localhost ypbind". This command
  362.       should produce something like:
  363.  
  364.       <tscreen><verb>
  365.         program 100007 version 2 ready and waiting
  366.       </verb></tscreen>
  367.  
  368. </itemize>
  369.  
  370. Finally, do not forget that for host lookups you must set (or add)
  371. "nis" to the lookup order line in your /etc/host.conf file. Please read
  372. the manpage "resolv+.8" for more details.
  373.  
  374. At this point you should be able to use NIS client programs like ypcat,
  375. etc...  For example, "ypcat passwd" will give you the entire NIS
  376. password database.
  377.  
  378. IMPORTANT: If you skipped the test procedure then make sure you have set
  379. the domain name, and created the directory:
  380.  
  381. <tscreen><verb>
  382.     /var/yp
  383. </verb></tscreen>
  384.  
  385. This directory MUST exist for ypbind to start up succesfully.
  386.  
  387. If the test worked you may now want to change the files /etc/rc.d/rc.M
  388. and /etc/rc.d/rc.inet2 on your system so that ypbind will be started up
  389. at boot time and your system will act as a NIS client. Edit the file
  390. /etc/rc.d/rc.M and look for the commands which set the domain name.
  391. Change the domain name into the name of your domain. Also, edit the
  392. file /etc/rc.d/rc.inet2, comment out the lines which start up the
  393. rpc.portmap daemon, and add the following lines just after the place
  394. where rpc.portmap is started:
  395.  
  396. <tscreen><verb>
  397.     #
  398.     # Start the ypbind daemon
  399.     #
  400.     if [ -f ${NET}/ypbind -a -d /var/yp ]; then
  401.         echo -n " ypbind"
  402.         ${NET}/ypbind
  403.     fi
  404. </verb></tscreen>
  405.  
  406. Unlike Sun's implementation of NIS you do not need to edit /etc/passwd
  407. and /etc/group to take advantage of NIS. Sun's implementation needs a
  408. line "+:*:0:0:::" in /etc/passwd and a line "+:*:0:" in /etc/group to
  409. tell NIS to search the NIS password and group databases.
  410.  
  411. IMPORTANT: Note that the command finger will report "no such user"
  412. messages if you do not add the line "+:*:0:0:::" to /etc/passwd.
  413. Putting the line "+:*:0:0:::" back in /etc/passwd fixes finger.
  414.  
  415. Well, that's it. Reboot the machine and watch the boot messages to see
  416. if ypbind is actually started.
  417.  
  418. IMPORTANT: Note that the netgroup  feature is implemented starting
  419. from libc 4.5.26. Netgroups allow access control for every machine and
  420. every user in the NIS domain, and they require an entry like:
  421.  
  422. <tscreen><verb>
  423.     +@this_machine_users
  424. </verb></tscreen>
  425.  
  426. in /etc/passwd. But if you have a version of libc erlier than 4.5.26,
  427. every  user  in  the  NIS password database can access your linux
  428. machine if you run "ypbind".
  429.  
  430.  
  431. <sect>What you need to set up NYS?
  432.  
  433. <sect1>Determine whether you are a Server, Slave or Client.
  434.  
  435. <p>
  436. To answer this question you have to consider two cases:
  437.  
  438. <itemize>
  439. <item>Your machine is going to be part of a network with
  440.       existing NIS servers
  441.  
  442. <item>You do not have any NIS servers in the network yet
  443. </itemize>
  444.  
  445. In the first case you have two choices:
  446.  
  447. <itemize>
  448. <item>Either you relink all client and daemon programs with the
  449.     NYS library <tt>libnsl.so</tt> (or statically link them with
  450.     <tt>libnsl.a</tt>). This means adding the line:
  451.  
  452.     <tscreen><verb>
  453.         LIBS=-lnsl
  454.     </verb></tscreen>
  455.  
  456.     to your Makefile signifing you want to link the Network
  457.     Services Library. Basically all network deamons and the
  458.     "login" program need to be recompiled.
  459.  
  460. <item>Or you can recompile the standard C library <tt>libc</tt> to include
  461.     the NYS client library functions into the normal libc library,
  462.     and then relink all statically linked programs (the dynamically
  463.     linked programs automatically get the new version of libc).
  464.     See section 6.5 below for more information about this option.
  465. </itemize>
  466.  
  467. Similarly like in the case of traditional NIS, if you don't have NIS
  468. servers, then you will also need a NIS server program (usually called
  469. ypserv) and you have to designate one of the machines in your network
  470. as a master NIS server. Again, you might want to set up at least one
  471. slave server as well.
  472.  
  473.  
  474. <sect1>The Software
  475.  
  476. <p>
  477. You need to retrieve and compile the NYS services library libnsl.so.
  478. If you don't have the DLL tools installed you may retrieve a
  479. precompiled shared, static and stub library from the same site
  480. mentioned below. Note, however, that the precompiled version may be
  481. (and probably is) older than the latest source code release.
  482.  
  483. The NYS library (source and precompiled version)  can be obtained from:
  484.  
  485. <tscreen><verb>
  486.     Site                Directory                      File Name
  487.  
  488.     ftp.lysator.liu.se  /pub/NYS/libs                  nys-0.27.4.tar.gz
  489.     ftp.lysator.liu.se  /pub/NYS/binaries/lib          libnsl.so.1.0.a26
  490.  
  491.     ftp.funet.fi        /pub/OS/Linux/BETA/NYS/libs    nys-0.27.4.tar.gz
  492.     ftp.funet.fi        /pub/OS/Linux/BETA/NYS/lib     libnsl.so.1.0.a26
  493. </verb></tscreen>
  494.  
  495. Precompiled "login" and "su" programs may also be fetched from
  496.  
  497. <tscreen><verb>
  498.     Site                Directory                      File Name
  499.  
  500.     ftp.lysator.liu.se  /pub/NYS/binaries/bin          login
  501.     ftp.lysator.liu.se  /pub/NYS/binaries/bin          su
  502.  
  503.     ftp.funet.fi        /pub/OS/Linux/BETA/NYS/bin     login
  504.     ftp.funet.fi        /pub/OS/Linux/BETA/NYS/bin     su
  505. </verb></tscreen>
  506.  
  507. Similarly, example configuration files may be retrieved from
  508.  
  509. <tscreen><verb>
  510.     Site                Directory                      File Name
  511.  
  512.     ftp.lysator.liu.se  /pub/NYS/binaries/etc          *conf
  513.     ftp.funet.fi        /pub/OS/Linux/BETA/NYS/etc     *conf
  514. </verb></tscreen>
  515.  
  516. For compilation of the nsl library, please follow the instructions
  517. which come with the software. If you wish to compile the shared DLL
  518. library you must have the DLL tools installed in the standard place
  519. (/usr/dll). The DLL tools (the package tools-2.11.tar.gz or later) can
  520. be obtained from many sites.
  521.  
  522.  
  523. <sect1>Setting up a NYS Client using NYS
  524.  
  525. <p>
  526. Unlike traditional NIS, there is no setting up required for a NIS
  527. client. All that is required is that the NIS configuration file
  528. (/etc/yp.conf) points to the correct server(s) for its information.
  529. Also, the Name Services Switch configuration file (/etc/nsswitch.conf)
  530. must be correctly set up.
  531.  
  532. Please refer to the examples provided with the source code.
  533.  
  534.  
  535. <sect1>The nsswitch.conf File
  536.  
  537. <p>
  538. The Network Services switch file /etc/nsswitch.conf determines the
  539. order of lookups performed when a certain piece of information is
  540. requested, just like the /etc/host.conf file which determines the way
  541. host lookups are performed. Again, look at at the example file provided
  542. in the source distribution. For example, the line
  543.  
  544. <tscreen><verb>
  545.     hosts: files nis dns
  546. </verb></tscreen>
  547.  
  548. specifies that host lookup functions should first look in the local
  549. /etc/hosts file, followed by a NIS lookup and finally thru the domain
  550. name service (/etc/resolv.conf and named), at which point if no match
  551. is found an error is returned.
  552.  
  553.  
  554. <sect1>Making your binaries NYS aware
  555.  
  556. <p>
  557. Instead of relinking each binary with the NYS library (libnsl.so), a
  558. cleaner solution has been achieved by providing the user with the
  559. ability to build a NYS aware libc. This means all you need to do is
  560. recompile a new libc and replace your existing /lib/libc.so.x.y.z for
  561. all (non-static compiled) programs to be NYS aware.
  562.  
  563. This merge also gives you the advantage over the traditional NIS
  564. implementation in the linux libc in that it allows transparent shadow
  565. passwords support (via the /etc/nisswitch.conf file).
  566.  
  567. Follow the simple steps below to rebuild a NYS aware libc.
  568.  
  569. <itemize>
  570. <item>Make sure you have the latest DLL tools installed. Refer to
  571.       the the GCC-FAQ for more info on where to get this.
  572.  
  573. <item>Get the latest libc sources. (again see GCC-FAQ)
  574.  
  575. <item>Get the latest nys sources from 
  576.  
  577.       <tscreen><verb>
  578.           ftp.lysator.liu.se:/pub/NYS/libs
  579.       </verb></tscreen>
  580.  
  581.       and extract it under this libc-linux source directory.
  582.       The current NYS distribution is "nys-0.27.4.tar.gz".
  583.  
  584. <item>Do the ./configure as before and first answer "n" to the
  585.       question
  586.  
  587.       <tscreen><verb>
  588.           Values correct (y/n) [y] ?
  589.       </verb></tscreen>
  590.  
  591.       Then go thru all the other questions and the last question
  592.       will now be
  593.  
  594.       <tscreen><verb>
  595.           Build a NYS libc from nys-0.27 (y default) ?
  596.       </verb></tscreen>
  597.  
  598.       answer "y" to this.
  599.  
  600. <item>Then issue the command
  601.  
  602.       <tscreen><verb>
  603.           % make
  604.       </verb></tscreen>
  605.  
  606. </itemize>
  607.  
  608. The library generated after compilation is named something like
  609.  
  610. <tscreen><verb>
  611.     libc.so.4.5.26
  612. </verb></tscreen>
  613.  
  614. and placed under the directory jump/libc-nys. To install this library
  615. our advise would be copying it to /lib with a name lexiographically
  616. greater than the version number it currently has. Just appending the
  617. letter "a" should do the trick.  For example:
  618.  
  619. <tscreen><verb>
  620.     % cp jump/libc-nys/libc.so.4.5.26 /lib/libc.so.4.5.26a
  621. </verb></tscreen>
  622.  
  623. Alternatively, append "nys" to it so you can quickly identify it.
  624. Now run the command
  625.  
  626. <tscreen><verb>
  627.     % ldconfig
  628. </verb></tscreen>
  629.  
  630. which will reset your cache to use the new library. The dynamic linker
  631. strategy may be examined with the command "ldconfig -p".
  632.  
  633. That's basically it. All your programs should now be NYS aware. Please
  634. note that usually the program "login" is compiled static and thus
  635. cannot access the new NYS functions from the NYS aware libc. You must
  636. either recompile "login" without the -static flag, or else statically
  637. link it to the libnsl.a library.
  638.  
  639.  
  640. <sect>Setting up a NIS Server
  641.  
  642. <sect1>The Server Program ypserv
  643.  
  644. <p>
  645. This document only describes how to set up the "ypserv" NIS server.
  646. The "yps" server setup is similar, _but_ not exactly the same so
  647. beware if you try to apply these instructions to "yps"!
  648.  
  649. The NIS server software can be found on:
  650.  
  651. <tscreen><verb>
  652.     Site                Directory                          File Name
  653.  
  654.     ftp.lysator.liu.se  /pub/NYS/servers                   ypserv-0.11.tar.gz
  655.     ftp.funet.fi        /pub/OS/Linux/BETA/NYS/servers     ypserv-0.11.tar.gz
  656.     mcsun.eu.net        /os/linux/BETA/NYS/servers         ypserv-0.11.tar.gz
  657.     ftp.univie.ac.at    /unix/system/linux/funet/BETA/NYS/servers
  658.                                                            ypserv-0.11.tar.gz
  659. </verb></tscreen>
  660.  
  661. The server setup is the same for both traditional NIS and NYS.
  662.  
  663. Compile the software to generate the "ypserv", "dbcat" and "dbload"
  664. programs.  Firstly, determine what files you require to be available
  665. via NIS and then add or remove the appropriate entries to the
  666. ypMakefile. Install the file <tt>ypMakefile</tt> into <tt>/var/yp</tt>
  667. as the file <tt>Makefile</tt>.
  668.  
  669. Now build the DBM files by typing:
  670.  
  671. <tscreen><verb>
  672.     % cd /var/yp; make
  673. </verb></tscreen>
  674.  
  675. Make sure the portmapper (rpc.portmap) is running, and start the
  676. server "ypserv". The command
  677.  
  678.  
  679. <tscreen><verb>
  680.     % rpcinfo -u localhost ypserv
  681. </verb></tscreen>
  682.  
  683. should output something like
  684.  
  685. <tscreen><verb>
  686.     program 100004 version 2 ready and waiting
  687. </verb></tscreen>
  688.  
  689. That's it, your server is up and running.
  690.  
  691.  
  692. <sect1>The Program yppasswdd
  693.  
  694. <p>
  695. Whenever users change their passwords, the NIS password database and
  696. probably other NIS databases, which depend on the NIS password
  697. database, should be updated.  The program "yppasswdd" is a server that
  698. handles password changes and makes sure that the NIS information will
  699. be updated accordingly. The software for "yppasswdd" can be found on:
  700.  
  701. <tscreen><verb>
  702.     Site                   Directory                      File Name
  703.  
  704.     ftp.lysator.liu.se    /pub/NYS                        yppasswdd-0.5.tar.gz
  705.     ftp.funet.fi          /pub/OS/Linux/BETA/NYS/servers  yppasswdd-0.5.tar.gz
  706. </verb></tscreen>
  707.  
  708. Once you obtained the software, please follow the instructions which
  709. come with the software.
  710.  
  711.  
  712. <sect>Verifying the NIS/NYS Installation
  713.  
  714. <p>
  715. If everything is fine (as it should be), you should be able to verify
  716. your installation with a few simple commands. Assuming, for example,
  717. your passwd file is being supplied by NIS, the command
  718.  
  719. <tscreen><verb>
  720.     % ypcat passwd
  721. </verb></tscreen>
  722.  
  723. should give you the contents of your NIS passwd file. The command
  724.  
  725. <tscreen><verb>
  726.     % ypmatch userid passwd
  727. </verb></tscreen>
  728.  
  729. (where userid is the login name of an arbitrary user) should give you
  730. the user's entry in the NIS passwd file. The "ypcat" and "ypmatch"
  731. programs should be included with your distribution of traditional
  732. NIS or NYS.
  733.  
  734.  
  735. <sect>Common Problems and Troubleshooting NIS
  736.  
  737. <p>
  738. Here are some common problems reported by various users:
  739.  
  740. <enum>
  741. <item>The libraries for 4.5.19 are broken. NIS won't work with it.
  742.  
  743. <item>If you upgrade the libraries from 4.5.19 to 4.5.24 then the
  744.        su command breaks. You need to get the su command from the
  745.        slackware 1.2.0 distribution. Incidentally that's where you
  746.        can get the updated libraries.
  747.  
  748. <item>You could run into trouble with NIS and DNS on the same machine.
  749.        My DNS server occasionally will not bring up NIS. Haven't yet
  750.        tracked down why.
  751.  
  752. <item>When a NIS server goes down and comes up again ypbind starts
  753.        complaining with messages like:
  754.  
  755.     <verb>
  756.          yp_match: clnt_call:
  757.                      RPC: Unable to receive; errno = Connection refused
  758.     </verb>
  759.  
  760.        and logins are refused for those who are registered in the
  761.        NIS database. Try to login as root and if you succeed, then kill
  762.        ypbind and start it up again.
  763. </enum>
  764.  
  765.  
  766. <sect>Frequently Asked Questions
  767.  
  768. <p>
  769. Most of your questions should be answered by now. If there are still
  770. questions unanswered you might want to post a message to
  771.  
  772. <tscreen><verb>
  773.     comp.os.linux.help
  774. </verb></tscreen>
  775.  
  776. or contact one of the authors of this HOWTO.
  777.  
  778. </article>
  779.