Transwiki:NIS Configuration on Debian

Basic Configuration
In Debian-based Linux distributions, three files should be modified. enigma NISSERVER=master ypserver 127.0.0.1 In /etc/nsswitch.conf, make sure you have passwd, group, shadow and netgroup entries like this: passwd:        compat group:         compat shadow:        compat netgroup:      nis
 * 1) /etc/defaultdomain
 * 1) /etc/default/nis
 * 1) /etc/yp.conf - ypbind configuration file
 * 1) /etc/nsswitch.conf

Starting Server Daemon
root@enigma:/etc# init.d/portmap start * Starting portmap daemon...  ...done. root@enigma:/etc# init.d/nis start Starting NIS services: ypserv yppasswdd ypxfrd ypbind On success, the following information is expected: root@enigma:/etc# rpcinfo -p localhost program vers proto  port 100000   2   tcp    111  portmapper 100000   2   udp    111  portmapper 100007   2   udp    717  ypbind 100007   1   udp    717  ypbind 100007   2   tcp    720  ypbind 100007   1   tcp    720  ypbind 100009   1   udp    706  yppasswdd 600100069   1   udp    709  fypxfrd 600100069   1   tcp    711  fypxfrd 100004   2   udp    704  ypserv 100004   1   udp    704  ypserv 100004   2   tcp    708  ypserv 100004   1   tcp    708  ypserv Sometimes you might not see ypbind and fypxfrd in the list. You should finish the next step and rerun the command.

Initializing Master Server
root@enigma:/etc# /usr/lib/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS servers. localhost.localdomain is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a . next host to add: localhost.localdomain next host to add: The current list of NIS servers looks like this:

localhost.localdomain

Is this correct? [y/n: y] y We need a few minutes to build the databases... Building /var/yp/enigma/ypservers... Running /var/yp/Makefile... make[1]: Entering directory `/var/yp/enigma' Updating passwd.byname... Updating passwd.byuid... ...... Updating shadow.byname... make[1]: Leaving directory `/var/yp/enigma'

localhost.localdomain has been set up as a NIS master server.

Now you can run ypinit -s localhost.localdomain on all slave server. Be sure to start portmap before typing this command, otherwise you will get an error and have to manually delete /var/yp/enigma.

Adding New Users
It is recommended to add groups and users by using addgroup and adduser scripts, which are able to synchronize NIS information automatically. If not, you should do this manually after adding new groups or users: root@enigma:/etc# cd /var/yp root@enigma:/var/yp# make make[1]: Entering directory `/var/yp/enigma' Updating passwd.byname... Updating passwd.byuid... Updating netid.byname... Updating shadow.byname... make[1]: Leaving directory `/var/yp/enigma' NIS clients should restart /etc/init.d/nis service in order to keep updated.

Basic Configuration
Like server configuration, make sure you have passwd, group, shadow and netgroup entries like this: passwd:        compat group:         compat shadow:        compat netgroup:      nis Then configure NIS domain name and NIS server: enigma ypserver enigma Your /etc/hosts should contain a line like: 192.168.4.131 enigma
 * 1) /etc/nsswitch.conf
 * 1) /etc/defaultdomain
 * 1) /etc/yp.conf
 * 1) /etc/hosts

Modifying Authentication Files
root@nis-client:/etc# echo '+::::::' >> /etc/passwd root@nis-client:/etc# echo '+::::::::' >> /etc/shadow root@nis-client:/etc# echo '+:::' >> /etc/group It is also possible to grant or restrict the access of specified users. It is a little complex and will not be discussed here. Refer to Debian NIS HOWTO if you want to know more.

Starting Client Daemon
root@nis-client:/etc# /etc/init.d/portmap start * Starting portmap daemon...  ...done. root@nis-client:/etc# /etc/init.d/nis start Starting NIS services: ypbind