• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar

The Geek Diary

HowTos | Basics | Concepts

  • Solaris
    • Solaris 11
    • SVM
    • ZFS
    • Zones
    • LDOMs
    • Hardware
  • Linux
    • CentOS/RHEL 7
    • RHCSA notes
    • SuSE Linux Enterprise
    • Linux Services
  • VCS
    • VxVM
  • Interview Questions
  • oracle
    • ASM
    • mysql
    • RAC
    • oracle 12c
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Hadoop
    • Hortonworks HDP
      • HDPCA
    • Cloudera
      • CCA 131

How to configure a NIS server and client in CentOS/RHEL/Fedora

By admin

This post will provide an example of the NIS configuration procedures. This will include which packages are needed for a NIS server and client and the procedures for configuration of both server and client.

Setting up a NIS Server

The packages that are required for setting up a NIS Server are:

  • ypserv
  • ypbind
  • portmap
  • yp-tools

It is possible to check whether the following packages are installed on the system using the command rpm -q [package-name], e.g.

# rpm -q ypserv ypbind portmap yp-tools

If any of these packages are not installed they can be installed using yum package manager:

# yum install -y ypserv ypbind portmap yp-tools

Perform the following steps to configure the NIS server:

1. The NIS domain needs to be added in /etc/sysconfig/network. Edit the file and add the following line to the end of the file:

# vi /etc/sysconfig/network
NISDOMAIN=DOMAIN-NAME

Replace DOMAIN-NAME with the actual domain name of the server, ensure it is in capitals.

2. Execute the command below so that the domain name is set immediately without rebooting system:

# ypdomainname DOMAIN-NAME

3. Verify that it is set correctly:

# ypdomainname 
DOMAIN-NAME

4. The NIS Server also needs to be set up as a client. Edit the /etc/yp.conf file and add the following line:

# vi /etc/yp.conf
ypserver 127.0.0.1

5. Start the daemons NIS needs:

For RHEL3, 4, 5:

# service portmap start
# service yppasswdd start
# service ypserv start

For RHEL6:

# service rpcbind start
# service yppasswdd start
# service ypserv start

For RHEL7:

# systemctl start rpcbind
# systemctl start yppasswdd
# systemctl start ypserv

and ensure they are started on system boot up:

For RHEL3, 4, 5:

# chkconfig portmap on
# chkconfig yppasswdd on
# chkconfig ypserv on

For RHEL6:

# chkconfig rpcbind on
# chkconfig yppasswdd on
# chkconfig ypserv on

For RHEL7:

# systemctl enable rpcbind
# systemctl enable yppasswdd
# systemctl enable ypserv

6. Next, edit /var/yp/Makefile to reflect the following (Don’t merge the passwd file with the shadow file):

# vi /var/yp/Makefile
MERGE_PASSWD=false

Ensure to build the shadow file.

all:  passwd group hosts rpc services netid protocols mail shadow

7. Generate the NIS database (for 32 bit):

# /usr/lib/yp/ypinit -m

or, for 64-bit installations,

# /usr/lib64/yp/ypinit -m

This command requires the NIS server name to be provided.

8. On RHEL 3, 4 and 5 run the command:

# system-config-authentication

On RHEL 6 and RHEL 7 run the command:

# authconfig --update --nisdomain=your-domain --nisserver=your-server --enablenis

This lets you specify the NIS domain and the NIS server. Enter the domain name as the one which is used previously and localhost as the NIS server.

9. Now start the remaining NIS services:

# service ypbind start
# service ypxfrd start
# service yppasswdd start

and ensure they are started on system boot

# chkconfig ypbind on
# chkconfig ypxfrd on
# chkconfig yppasswdd on

On RHEL 7 system, use below commands:

# systemctl start ypbind
# systemctl start ypxfrd
# systemctl start yppasswdd
# systemctl enable ypbind
# systemctl enable ypxfrd
# systemctl enable yppasswdd

The above steps complete the steps to configuring a master NIS Server.

Setting up a NIS Client

The following packages are required for setting up a client

  • ypbind
  • yp-tools

Perform the following steps to configure the NIS client:

1. On RHEL 3,4 and 5 run the command:

# system-config-authentication

On RHEL 6 and RHEL 7 run the command:

# authconfig --update --nisdomain=your-domain --nisserver=your-server --enablenis

This lets you specify the NIS domain and the NIS server. Enter the domain name as the one which is used previously and localhost as the NIS server.

Note: If you are not using DNS you will need to use the IP address when specifying the nisserver.

2. Start the ypbind services by executing the following commands:

# chkconfig ypbind on
# service ypbind start

On RHEL 7 systems use below commands instead:

# systemctl enable ypbind
# systemctl start ypbind

The above procedure is a simple example of setting up an NIS Server and Client. More information can be found at: http://www.linux-nis.org/

Check the user information from NIS Server

Execute the below command to check the user information from the NIS server. This command has to be run from a NIS client machine.

# ypcat passwd

Changing your user password

When you’re using NIS you will need to use the yppasswd command to change your password. Note that the normal passwd command does not change your NIS password.

How to configure NIS services to use static port in CentOS/RHEL

Filed Under: CentOS / RHEL 4, CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Fedora, Linux

Some more articles you might also be interested in …

  1. Linux OS service ‘auditd’
  2. mdadm Command Shows State : active, degraded
  3. How to automate sftp file transfers using expect utility
  4. How to disable IPv6 on CentOS / RHEL 7
  5. How to manage systemd services with a non-root user
  6. CentOS / RHEL : How to add iptable rules
  7. CentOS / RHEL 5 : How to password-protect single user mode
  8. Understanding Failover in a Pacemaker Cluster
  9. How to map devices in the iostat command output to their corresponding device mapper path
  10. How to Check CentOS Version

You May Also Like

Primary Sidebar

Recent Posts

  • How to set the order to load certain modules in CentOS/RHEL 7 and 8
  • How to configure initrd / initramfs to including kernel modules in CentOS/RHEL
  • How to configure systemd.path to trigger an event when any changes made to a directory
  • Script to monitor RMAN Backup and Restore Operations
  • Oracle RMAN Backup Shell Script Example
  • Archives
  • Contact Us
  • Copyright

© 2019 · The Geek Diary