You are on page 1of 9

8/9/2019 How do I configure a NIS server and client?

- Red Hat Customer Portal

C U S T O M E R (https://access.redhat.com/)
P O R TA L

How do I configure a NIS server and client?


$ SOLUTION VERIFIED - Updated August 20 2018 at 8:12 AM - English ()

Environment
Red Hat Enterprise Linux 3, 4, 5, 6, 7

Issue
How do I configure a NIS server and client?

Resolution
This article 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 as discussed in the Deployment
guide.

Perform the following steps to configure the NIS server:


https://access.redhat.com/solutions/7247 1/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal

1. The NIS domain needs to be added in /etc/sysconfig/network . Edit the file and add the
C U S T O M E R (https://access.redhat.com/)
following line to the
P Oend
R TAof
L the file:

NISDOMAIN=DOMAIN-NAME

Replacing DOMAIN-NAME with the actual domain name of the server, ensuring 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:

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 and RHEL7:

# service rpcbind start


# service yppasswdd start
# service ypserv start

and ensure they are started on system boot up:

For RHEL3, 4, 5:

https://access.redhat.com/solutions/7247 2/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal

O M E R (https://access.redhat.com/)
C U S Ton
# chkconfig portmap
P O R TA
# chkconfig yppasswdd on L

# chkconfig ypserv on

For RHEL6, 7:

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

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

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.

https://access.redhat.com/solutions/7247 3/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal

9. Now start the remaining NIS services:


C U S T O M E R (https://access.redhat.com/)
P O R TA L

# 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

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

Setting up a Slave NIS Server


Slave NIS Servers can be added as well. For more information, the following resources are available:

1. http://www.linux-nis.org/nis-howto/HOWTO/setting_nis.html (http://www.linux-nis.org/nis-
howto/HOWTO/setting_nis.html)
2. Man pages for ypserv(8) and ypserv.conf(5)

Note: Port 111 needs to be made available on the server for clients to connect. Look for additional
articles in the knowledgebase for more information about securing a 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

https://access.redhat.com/solutions/7247 4/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal

This lets you specify the NIS domain and the NIS server. Enter the domain name as the one
C U S T O M E R (https://access.redhat.com/)
which is used previously
P O R TAand
L 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

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/ (http://www.linux-nis.org/)

Check the user information from NIS Server


Execute the command:

# 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.

Other NIS references


For information on setting up passwd.adjunct please see the article How do I set up passwd.adjunct
on RHEL5? (/knowledge/node/44965)

Product(s) Red Hat Enterprise Linux (/taxonomy/products/red-hat-enterprise-linux)

Component ypserv (/components/ypserv) Category Learn more (/category/learn-more)

Tags configuration (/tags/configuration) nis (/tags/nis) redhat (/tags/redhat)

red_hat_enterprise_linux (/tags/red_hat_enterprise_linux) rhel (/tags/rhel) rhel_4 (/tags/rhel_4)


rhel_5 (/tags/rhel_5) rhel_6 (/tags/rhel_6) rhel_7 (/taxonomy/tags/rhel7)

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions
that Red Hat engineers have created while supporting our customers. To give you the knowledge
you need the instant it becomes available, these articles may be presented in a raw and unedited

https://access.redhat.com/solutions/7247 5/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal

form.
C U S T O M E R (https://access.redhat.com/)
P O R TA L

People who viewed this solution also viewed

ypbind cannot start with a failure of binding to NIS server in Red Hat Enterprise Linux 6

Solution - Apr 23, 2018

Cannot bind to NIS server and ypbind crashed every time.

Solution - Oct 10, 2014

NIS and ypbind starts on random ports

Solution - Aug 7, 2019

9 Comments
8 October 2010 1:58 AM (https://access.redhat.com/solutions/7247#comment-319963)
RS Rajesh Subrmaniam (/user/799213)
(/user/799213)
There are two things that did not work for me on a RedHat 5.5 (64Bit) installation
NEWBIE
     The creation of the NIS database command
5 Points

/usr/lib/yp/ypinit -m

https://access.redhat.com/solutions/7247 6/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal

Needs to be /usr/lib64/ypinit -m for a 64Bit installation


C U S T O M E R (https://access.redhat.com/)
P O R TA L

Number 2, the authconfig just provides options it does not start the configuration
routine.

    I had to use the System / Administation / Authorization to configure the NIS client.

≤ Reply (/Ajax_comments/Reply/7247/319963)

6 December 2011 9:50 PM (https://access.redhat.com/solutions/7247#comment-336453)


PM Pete Matthews, RHCE (/user/1257673)
(/user/1257673)
On RHEL-6, authconfig requires arguments.  This worked for me:
COMMUNITY
MEMBER
authconfig --update --nisdomain=your-domain --nisserver=your-server --enable-nis
25 Points

This started ypbind and ran chkconfig.  I had previously put NISDOMAIN=your-domain
into /etc/sysconfig/network, so YMMV.

However, ypbind did not come up when I rebooted the system, even though chkconfig
said it should.  service ypbind start worked fine.  Thought I had an answer... I'm opening
a ticket instead.  Sorry.

≤ Reply (/Ajax_comments/Reply/7247/336453)

20 September 2013 7:42 AM (https://access.redhat.com/solutions/7247#comment-542213)


YD Yves De Ceuleners (/user/560273)
(/user/560273)
ypbind should start after ypserv on the NIS master. Change the chkconfig line in
NEWBIE /etc/init.d so that it starts later:
5 Points
By default it looks like this:

grep chkconfig /etc/init.d/ypbind


# chkconfig: - 27 76

But you should update it that it looks like this:

grep chkconfig /etc/init.d/ypbind


# chkconfig: - 70 76

Do not forget to update the rc-scripts afterwards.

https://access.redhat.com/solutions/7247 7/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal

≤ Reply (/Ajax_comments/Reply/7247/542213)
C U S T O M E R (https://access.redhat.com/)
P O R TA L

20 September 2013 5:15 PM (https://access.redhat.com/solutions/7247#comment-542523)

Akemi Yagi (/user/856543)


(/user/856543)
On RHEL 6, the default for ypbind is:
GURU

2979 # chkconfig: - 24 76
Points

and the default for ypserv is:

# chkconfig: - 26 74

ypbind must be started after ypserv, so changing ypbind's default to 27 (or higher) is
necessary.

≤ Reply (/Ajax_comments/Reply/7247/542523)

20 September 2013 5:22 PM (https://access.redhat.com/solutions/7247#comment-542533)

Akemi Yagi (/user/856543)


(/user/856543)
Found a bug report here:
GURU
https://bugzilla.redhat.com/show_bug.cgi?id=953555
2979
Points
≤ Reply (/Ajax_comments/Reply/7247/542533)

11 June 2014 5:39 PM (https://access.redhat.com/solutions/7247#comment-770893)


UK Uwe Koziolek (/user/1555733)
(/user/1555733)
RHEL 7 client:
COMMUNITY systemctl enable ypbind
MEMBER

25 Points instead of chkconfig ... and service ...

≤ Reply (/Ajax_comments/Reply/7247/770893)

4 March 2016 8:22 PM (https://access.redhat.com/solutions/7247#comment-1022091)


JP James Porter (/user/3857063)
(/user/3857063)

https://access.redhat.com/solutions/7247 8/9
8/9/2019 How do I configure a NIS server and client? - Red Hat Customer Portal
NEWBIE
Good information. A little confusing as the various red hat versions are mixed into a
C U S T O M E R (https://access.redhat.com/)
11 Points single page.
PO Better
R TA L would be separate pages for each RH release.

≤ Reply (/Ajax_comments/Reply/7247/1022091)

16 January 2017 7:41 PM (https://access.redhat.com/solutions/7247#comment-1138571)


HT Holly Thomas (/user/2837183)
(/user/2837183)
Did not work fro me
NEWBIE

19 Points ≤ Reply (/Ajax_comments/Reply/7247/1138571)

21 July 2017 9:06 AM (https://access.redhat.com/solutions/7247#comment-1198681)


AA aneesh ansari (/user/14525841)
(/user/14525841)
Hello ,
NEWBIE
i configured NIS server , i can login from client machine but user's home directory data
5 Points
is not available.

thanks

≤ Reply (/Ajax_comments/Reply/7247/1198681)

All systems operational (https://status.redhat.com)

Privacy Statement (http://www.redhat.com/en/about/privacy-


policy)
Customer Portal Terms of Use
(https://access.redhat.com/help/terms/)
All Policies and Guidelines
(http://www.redhat.com/en/about/all-policies-guidelines)
Copyright © 2019 Red Hat, Inc.

https://access.redhat.com/solutions/7247 9/9

You might also like