Dec 232000
 

Setting up FreeBSD as an NIS client

This article was written by Eric Anderson.

So what if you want to use your FreeBSD box as a client on a network that is running NIS?  Simple!  This should walk you through most of the setup.   Of course, have FreeBSD 3.3 or greater installed with your network settings already working before doing this.

Setting up the client

We are going to assume a few things about your setup.  Your NIS domain is domain.com, and your NIS servers are nisserver1 (master) and nisserver2 (slave).   Edit your /etc/rc.conf and add the following lines:
nis_client_enable="YES"
nisdomainname="domain.com"
nis_client_flags="-S domain.com,nisserver1,nisserver2"

The spacing is important on some versions of FreeBSD, so be careful to keep the spacing correct.

Now, edit your /etc/group file, and add a + to the end (last line). It should look something like:

dialer:*:68:
network:*:69:
nogroup:*:65533:
nobody:*:65534:
+

Editing name resolution order

Next, edit your /etc/host.conf file, and make sure you uncomment nis, so it looks something like:
# $FreeBSD: src/etc/host.conf,v 1.5.2.1 1999/08/29 14:18:44 peter Exp $
# First try the /etc/hosts file
hosts
# Now try the nameserver next.
bind
# If you have YP/NIS configured, uncomment the next line
nis

Editing the hosts file

Edit your /etc/hosts file and make sure you have the local machine, and both NIS servers in the list.  Add a +:: to the end (last line). It should look something like this (you may not have to do this if you are a name server):
# $FreeBSD: src/etc/hosts,v 1.9.2.1 1999/08/29 14:18:44 peter Exp $
#
# Host Database
# This file should contain the addresses and aliases
# for local hosts that share this file.
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/host.conf for the resolution 
# order.
#
#
127.0.0.1               localhost.yourdomain.com localhost
10.1.1.222              fridge.yourdomain.com fridge
10.1.1.76               nisserver1.yourdomain.com nisserver1
10.1.1.31               nisserver2.yourdomain.com nisserver2
+::

Editing the master.passwd file

Now do a vipw master.passwd, and add a +::::::::: to the end (last line) of the file.  It should look something like this:
uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/libexec/uucp/uucico
xten:*:67:67::0:0:X-10 daemon:/usr/local/xten:/sbin/nologin
pop:*:68:6::0:0:Post Office Owner:/nonexistent:/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/sbin/nologin
+:::::::::

Do NOT edit the passwd file, and make sure you have the right number of :’s.   Also, make sure you have the correct DNS settings in your /etc/resolv.conf file.