To answer this question you have to consider two cases:
In the first case you have two choices:
libnsl.so
(or statically link them with
libnsl.a
). This means adding the line:
LIBS=-lnsl
to your Makefile signifing you want to link the Network
Services Library. Basically all network deamons and the
"login" program need to be recompiled.
libc
to include
the NYS client library functions into the normal libc library,
and then relink all statically linked programs (the dynamically
linked programs automatically get the new version of libc).
See section 6.5 below for more information about this option.Similarly like in the case of traditional NIS, if you don't have NIS servers, then you will also need a NIS server program (usually called ypserv) and you have to designate one of the machines in your network as a master NIS server. Again, you might want to set up at least one slave server as well.
You need to retrieve and compile the NYS services library libnsl.so. If you don't have the DLL tools installed you may retrieve a precompiled shared, static and stub library from the same site mentioned below. Note, however, that the precompiled version may be (and probably is) older than the latest source code release.
The NYS library (source and precompiled version) can be obtained from:
Site Directory File Name
ftp.lysator.liu.se /pub/NYS/libs nys-0.27.4.tar.gz
ftp.lysator.liu.se /pub/NYS/binaries/lib libnsl.so.1.0.a26
ftp.funet.fi /pub/OS/Linux/BETA/NYS/libs nys-0.27.4.tar.gz
ftp.funet.fi /pub/OS/Linux/BETA/NYS/lib libnsl.so.1.0.a26
Precompiled "login" and "su" programs may also be fetched from
Site Directory File Name
ftp.lysator.liu.se /pub/NYS/binaries/bin login
ftp.lysator.liu.se /pub/NYS/binaries/bin su
ftp.funet.fi /pub/OS/Linux/BETA/NYS/bin login
ftp.funet.fi /pub/OS/Linux/BETA/NYS/bin su
Similarly, example configuration files may be retrieved from
Site Directory File Name
ftp.lysator.liu.se /pub/NYS/binaries/etc *conf
ftp.funet.fi /pub/OS/Linux/BETA/NYS/etc *conf
For compilation of the nsl library, please follow the instructions which come with the software. If you wish to compile the shared DLL library you must have the DLL tools installed in the standard place (/usr/dll). The DLL tools (the package tools-2.11.tar.gz or later) can be obtained from many sites.
Unlike traditional NIS, there is no setting up required for a NIS client. All that is required is that the NIS configuration file (/etc/yp.conf) points to the correct server(s) for its information. Also, the Name Services Switch configuration file (/etc/nsswitch.conf) must be correctly set up.
Please refer to the examples provided with the source code.
The Network Services switch file /etc/nsswitch.conf determines the order of lookups performed when a certain piece of information is requested, just like the /etc/host.conf file which determines the way host lookups are performed. Again, look at at the example file provided in the source distribution. For example, the line
hosts: files nis dns
specifies that host lookup functions should first look in the local /etc/hosts file, followed by a NIS lookup and finally thru the domain name service (/etc/resolv.conf and named), at which point if no match is found an error is returned.
Instead of relinking each binary with the NYS library (libnsl.so), a cleaner solution has been achieved by providing the user with the ability to build a NYS aware libc. This means all you need to do is recompile a new libc and replace your existing /lib/libc.so.x.y.z for all (non-static compiled) programs to be NYS aware.
This merge also gives you the advantage over the traditional NIS implementation in the linux libc in that it allows transparent shadow passwords support (via the /etc/nisswitch.conf file).
Follow the simple steps below to rebuild a NYS aware libc.
ftp.lysator.liu.se:/pub/NYS/libs
and extract it under this libc-linux source directory.
The current NYS distribution is "nys-0.27.4.tar.gz".
Values correct (y/n) [y] ?
Then go thru all the other questions and the last question
will now be
Build a NYS libc from nys-0.27 (y default) ?
answer "y" to this.
% make
The library generated after compilation is named something like
libc.so.4.5.26
and placed under the directory jump/libc-nys. To install this library our advise would be copying it to /lib with a name lexiographically greater than the version number it currently has. Just appending the letter "a" should do the trick. For example:
% cp jump/libc-nys/libc.so.4.5.26 /lib/libc.so.4.5.26a
Alternatively, append "nys" to it so you can quickly identify it. Now run the command
% ldconfig
which will reset your cache to use the new library. The dynamic linker strategy may be examined with the command "ldconfig -p".
That's basically it. All your programs should now be NYS aware. Please note that usually the program "login" is compiled static and thus cannot access the new NYS functions from the NYS aware libc. You must either recompile "login" without the -static flag, or else statically link it to the libnsl.a library.