[How-To] Installing and Configuring NIS

The Network Information Service (NIS), utilizes daemons and a database to provide centralized authentication in a client-server architecture for Linux. It’s similar to the way the Active Directory provides centralized authentication for Windows clients in a Microsoft network. You only need to create, configure and modify objects ONCE on the NIS server. Those changes are then implemented on ALL your NIS clients.

This writeup is only concerned with setting the service up and getting things configured and functioning.

Securing NIS is very important, you must carefully control access to password and configuration files through hosts.allow, hosts.deny and encryption.

Server Side:

1. Install portmap (or rpcbind)

$ sudo apt-get install portmap

2. Update portmap defaults

$ sudo update-rc.d portmap defaults 10

3. Install NIS

$ sudo apt-get install nis

You will be asked for the name of your NIS domain, I used: mydomain.com
For the first time, NIS will give a fail message during the starting, don’t care about it ^_^

To edit the domain name:

$ sud nisdomainname test.com
[root@server18 ~]# nisdomainname

4. Edit /etc/default/nis

$ sudo vim /etc/default/nis

5. Edit /etc/ypserv.securenets by giving access to your clients (or network address)

$ sudo vim /etc/ypserv.securenets

6. Edit /var/yp/Makefile

$ sudo vim /var/yp/Makefile
All = passwd shadow group hosts ...

7. Restart the portmap daemon

$ sudo /etc/init.d/portmap restart

8. Restart the NIS daemon

$ sudo /etc/init.d/nis restart

9. Invoke /usr/lib/yp/ypinit to build NIS DB, you’ll be asked to add hosts, I just added one host, you can add more hosrs then press Ctrl + D

$ sudo /usr/lib/yp/ypinit -m

10. Add the users and groups to be used by NIS clients throughtout the network to the NIS Server

$ sudo useradd -d /home/NISUser1 -m NISUser1
$ sudo useradd -d /home/NISUser2 -m NISUser2

11. Give the new users passwords to login and authenticate with NIS clients in your Linux network

$ sudo passwd NISUser1
$ sudo passwd NISUser2

12. Compile the new users, groups and passwords into NIS database

$ cd /var/yp/
$ sudo make

13. Test it

$ ypcat passwd

Clients Side:

1. Verify basic connectivity to the network and NIS server (DNS, IP and host setting)

$ ifconfig
$ sudo vim /etc/hosts
...    ubuntuServer    server1.mydomain.com
$ ping ubuntuServer
$ ping server1.mydomain.com

2. Install portmap

$ sudo apt-get install portmap

3. Update portmap defaults

$ sudo update-rc.d portmap defaults 10

4. Install NIS, be sure to enter the same domain name: mydomain.com

$ sudo apt-get install nis

5. Edit /etc/yp.conf and add a server line

$ sudo vim /etc/yp.conf
domain mydomain.com server server1.mydomain.com

6. Edit /etc/nsswitch.conf

$ sudo vim /etc/nsswitch.conf
passwd: 	nis compat
group: 		nis compat
shadow: 	nis compat

7. Modify the permissions on the default /home folder so XWindows can allow users to login in graphically to a Gnome Deskyop

$ sudo chmod 777 /home

8. Reboot the NIS client

$ sudo reboot

9. Test NIS client’s connection to the NIS server

$ ypcat passwd
NISUser1 ...
NISUser2 ...

10. Login with NIS user (such as NISUser1 or NISUser2)

$ ypwhich

Et voilà !

PS: Try to use NFS and NIS to automounting Home Directories

Tagged: , , , , ,

7 thoughts on “[How-To] Installing and Configuring NIS

  1. […] Install and Configure NIS 2. Install and Configure […]

  2. Tarik MRABIT December 21, 2014 at 6:35 pm Reply

    I am sorry but i have a problem , i already have installed NIS with “sudo apt-get install nis” , but whene i do “sudo /etc/init.d/ nis” , i have this message “sudo: /etc/init.d/nis : commande not found” , what did i mess Please?

    • Boubakr December 21, 2014 at 8:32 pm Reply

      To start the NIS service, run: sudo /etc/init.d/nis start, you should specify the status (start, restart, stop…)

  3. Tarik MRABIT December 21, 2014 at 9:12 pm Reply

    yes that’s what i do.. sorry i didn’t montioned that , but stil nothing happen , same probleme!!

  4. Tarik MRABIT December 21, 2014 at 11:13 pm Reply

    is NIS still exist ?

  5. […] tried to configure NIS in a server and a client both running Ubuntu 14.04 following this guide and this official […]

Leave a Reply :

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: