What you need to set up NYS?

# 6 What you need to set up NYS?

Contents of this section

## 6.1 Determine whether you are a Server, Slave or Client.

To answer this question you have to consider two cases:

- Your machine is going to be part of a network with existing NIS servers
- You do not have any NIS servers in the network yet

In the first case, you only need to relink all client and deamon programs with the NYS library 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. However an alternate strategy is now available. See section 5.5 below on how to make your binaries NYS aware.

Similarly like in the case of the standard 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 (Note: not applicable to ypserv on Linux).

## 6.2 The Software

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.

The NYS library (source and precompiled version) can be obtained from:

> `

>         Site              Directory                      File Name

>         nic.funet.fi      /pub/OS/Linux/BETA/NYS         nys-0.27.1.tar.gz
>         nic.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

>         nic.funet.fi      /pub/OS/Linux/BETA/NYS/bin     login
>         nic.funet.fi      /pub/OS/Linux/BETA/NYS/bin     su

> `

Similarly, example configuration files may be retrieved from

> `

>         Site              Directory                      File Name

>         nic.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) can be obtained from many sites.

## 6.3 Setting up a NYS Client

Unlike NIS, there is no setting up required for a NYS client. All that is required is that the configuration files (/etc/yp.conf, /etc/nis.conf) point to the correct servers for their information. See the examples provided with the source code.

## 6.4 The nsswitch.conf File

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.

5.5. Making your binaries NYS aware

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 "standard" YP implementation in the linux libc in that it allows transparent shadow passwords support (via the /etc/nisswitch.conf file).

Follow these simple steps to rebuild a NYS aware libc.

- Make sure you have the latest DLL tools installed. Refer to the the GCC-FAQ for more info on where to get this.
- Get the latest libc sources. (again see GCC-FAQ)
- Get the latest nys sources from

  > `

  >               ftp.lysator.liu.se:/pub/NYS

  > `

  and extract it under this libc-linux source directory. The current NYS distribution is "nys-0.27.1.tar.gz".
- Do the ./configure as before and first answer `n' to the question

  > `

  >               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.
- Then issue the command

  > `

  >               % 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 I would avdise 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 I append "nys" to it so I 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.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter