Configure NIS Client CentOS 6

Configure NIS Client CentOS 6

This article assumes you have a NIS server setup and ready to go, if you do not, please visit Configure NIS Server CentOS 6

NIS (Network Information Service) shares user accounts, groups and other maps from one server, so the same users can log in on every client. On the client the work is done by ypbind, which finds the NIS server for your domain and answers lookups for the system.

Prerequisites

  • A working NIS server and its NIS domain name (not the DNS domain, although they are often similar).
  • Network access from the client to the server, including rpcbind on port 111 and the ypserv ports.
  • Root access on the client.

Step 1: log in and install ypbind

login as root

yum -y install ypbind.x86_64 at the root prompt on nisclient (same screenshot as the next step)

install ypbind

yum -y install ypbind.x86_64
yum -y install ypbind.x86_64 at the root prompt on nisclient

Step 2: enable NIS with authconfig-tui

open authconfig-tui

authconfig-tui
authconfig-tui typed at the root prompt on nisclient

configure exactly as shown, select only NIS and Use MD5 Passwords

authconfig-tui Authentication Configuration with Use NIS, Use MD5 Passwords and Use Shadow Passwords checked

In the screenshot Use Shadow Passwords is also checked, which is the default.

type in your NIS domain name, and the IP of the server

authconfig-tui NIS Settings with domain youNISname.local and server 192.168.1.166

hit ok

authconfig-tui output, Starting rpcbind and Binding NIS service OK

this is what a successful bind looks like (if not check the log directory /var/log)

authconfig writes the settings for you: the domain and server go into /etc/yp.conf, NISDOMAIN= is added to /etc/sysconfig/network so it survives a reboot, and nis is added to the passwd, shadow and group lines of /etc/nsswitch.conf. It also starts rpcbind and ypbind and enables them at boot.

Step 3: test

from here all we have to do is test su to an NIS user

su jim, whoami returns jim, and ypcat passwd shows the NIS passwd map entry

from here we run a few commands

su jim
whoami
ypcat passwd
su jim, whoami and ypcat passwd output (same screenshot as the previous step)

it looks like i’m logged in as jim, and can query the NIS database.

A few more checks that are useful:

ypwhich
domainname
getent passwd jim

ypwhich prints the NIS server the client is bound to, domainname shows the NIS domain, and getent proves the system (not just the yp tools) resolves the NIS user.

Troubleshooting

  • Binding NIS service fails or times out: check that the server is reachable, that its firewall allows rpcbind and ypserv, and that the domain name matches exactly. rpcinfo -p 192.168.1.166 should list ypserv.
  • ypcat works but su says the user does not exist: /etc/nsswitch.conf is missing nis; rerun authconfig-tui.
  • The user logs in but has no home directory: NIS only shares the account; home directories usually come from NFS with autofs.
  • Errors from ypbind are logged in /var/log/messages.

Newer releases

On RHEL, AlmaLinux and Rocky 8, authconfig was replaced by authselect. NIS is deprecated on current RHEL-compatible releases, and FreeIPA or LDAP with SSSD is the recommended replacement for new setups.

That’s it!

To get a hosted Linux Server visit www.zwiegnet.com/go to get started today!

Related guides: Configure NIS Server CentOS 6 | Configure NIS Slave CentOS 6

Leave a Reply

Your email address will not be published. Required fields are marked *