Tag Archives: yp

How to setup a NIS Slave server on Debian Squeeze

Assumptions

I am assuming that we have two networks linked with a vpn connection (net1: 10.99.0.0/24 and net2: 10.34.132.0/24). Also I am assuming that on net1 is a functional NIS master server.

NIS MASTER: nis1.test.org 10.99.0.10
NIS SERVER: nis2.test.org 10.34.132.195

How to setup a NIS client

If you put a servername in /etc/yp.conf, make sure the server is also in /etc/hosts. Otherwise if your system boots and the network is not yet up or DNS isn't reachable, ypserv cannot resolve the servers in /etc/yp.conf and will hang!

[codesyntax lang="bash"]

vim /etc/hosts

[/codesyntax]

10.99.0.10    nis1.test.org    nis1

Install the netbase, portmap and nis packages

[codesyntax lang="bash"]

apt-get install nis

[/codesyntax]

Configure NIS servers

[codesyntax lang="bash"]

vim /etc/yp.conf

[/codesyntax]

domain test-auth server nis1.test.org

Make domain binding persistent

[codesyntax lang="bash"]

vim /etc/defaultdomain

[/codesyntax]

test-auth

Setup 'running' domain

[codesyntax lang="bash"]

nisdomainname test-auth

[/codesyntax]

Update local maps search rules

[codesyntax lang="bash"]

vim /etc/nsswitch.conf

[/codesyntax]

passwd:         db files compat nis
group:          db files compat nis
shadow:         db files compat nis
netgroup:       nis

Restart NIS services

[codesyntax lang="bash"]

/etc/init.d/nis stop
/etc/init.d/nis start

[/codesyntax]

Make the auth process query NIS

[codesyntax lang="bash"]

vim /etc/passwd

[/codesyntax]

+@gods::0:0:::
+::0:0:::/bin/false

[codesyntax lang="bash"]

vim /etc/group

[/codesyntax]

+:::

Test NIS client setup

[codesyntax lang="bash"]

id user
ypwhich

[/codesyntax]

Setup a NIS server slave

[codesyntax lang="bash"]

vim /etc/default/nis

:%s/NISSERVER=false/NISSERVER=slave
:%s/YPPWDDIR=\/etc/YPPWDDIR=\/etc\/yp
:%s/NISMASTER=/NISMASTER=nis1.test.org
:wq

[/codesyntax]

Restart NIS server

[codesyntax lang="bash"]

/etc/init.d/nis stop
/etc/init.d/nis start

[/codesyntax]

Links:
http://lyre.mit.edu/~powell/debian-howto/nis.html
http://www.server-world.info/en/note?os=Debian_6.0&p=nis
http://www.linuxhelp.in/2010/05/how-to-install-and-configure-nis-server.html