Linux System Administration

0 of 84 lessons complete (0%)

Network Information System (NIS) and Network File System (NFS)

Running an NIS Server

You don’t have access to this lesson

Please register or sign in to access the course content.

To set up an NIS (Network Information Service) server, you’ll need to perform several steps. NIS allows for centralized management of user accounts and system configuration files in a Unix or Linux environment. Here’s a detailed guide to help you run an NIS server:

Step 1: Install NIS Server Packages

Ensure that the NIS server packages are installed on your system. The package name may vary depending on your Linux distribution:

# On Debian/Ubuntu 
sudo apt-get install ypserv 
# On Red Hat/CentOS 
sudo yum install ypserv

Step 2: Configure NIS Domain

Edit the NIS configuration file, typically located at /etc/defaultdomain, and specify the NIS domain name. Replace nisdomain with your chosen NIS domain name:

sudo nano /etc/defaultdomain # Add the line: nisdomainname nisdomain

Step 3: Initialize NIS Maps

Initialize the NIS maps using the ypinit command:

sudo /usr/lib/yp/ypinit -m

Follow the prompts to initialize the NIS maps. This process sets up the initial configuration for your NIS domain.

Step 4: Start NIS Server Service

Start the NIS server service (ypserv):

sudo service ypserv start # On SysV systems sudo systemctl start ypserv # On systemd systems

Step 5: Verify NIS Server Operation

Verify that the NIS server is operational by checking if the rpc.yppasswdd and rpc.ypxfrd services are running:

rpcinfo -p | grep yppasswdd rpcinfo -p | grep ypxfrd

Step 6: Set Up NIS Maps (Optional)

If you need additional NIS maps beyond the default ones (like passwd, group, etc.), you can configure and populate them on the NIS server.

Step 7: Add Users and Groups (Optional)

You can add users and groups directly to the NIS server, or you can configure it to fetch this information from other sources like LDAP.

Additional Tips:

  • Automate NIS Server Startup: Ensure the NIS server service starts automatically on system boot:
sudo systemctl enable ypserv # On systemd systems
  • Debugging and Troubleshooting: Use log files (/var/log/ypserv.log or /var/log/messages) to troubleshoot any issues with the NIS server.
  • Securing NIS: Since NIS communication is not secure by default, consider implementing additional security measures, such as running NIS over SSL (NIS+) or using VPNs.

By following these steps, you’ll have successfully set up and started an NIS server, allowing it to provide user authentication and system configuration information to NIS clients in your network.