*BSD News Article 82802


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!uwm.edu!cs.utexas.edu!howland.erols.net!panix!news.columbia.edu!sol.ctr.columbia.edu!startide.ctr.columbia.edu!wpaul
From: wpaul@ctr.columbia.edu (Bill Paul)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: *** Is there anybody using NIS under FreeBSD 2.1.5?
Date: 13 Nov 1996 17:30:18 GMT
Organization: Columbia University Center for Telecommunications Research
Lines: 88
Message-ID: <56d0ja$nee@sol.ctr.columbia.edu>
References: <56bktv$4bb@newsgate.dircon.co.uk>
NNTP-Posting-Host: startide.ctr.columbia.edu
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se, Thomas Yao
(thomas@dircon.co.uk) had the courage to say:

: I want two of my FreeBSD machines have the same password datatbase, so when
: I create one new user account I have to update another one as well. I don't
: mind to do that by myself if there are just few users, but we may have more
: than a thousand users! I guess we should try the yp (NIS) but after I read
: the man pages I think the yp on FreeBSD is incomplete. It says the FreeBSD
: doesn't support ypupdated, getservent, and getprotoent. I don't know how 
: critical those functions are, so I was wondering if the yp on FreeBSD could
: solve my problem. Can someone tell me where to find something to read? Or 
: can someone give me some tips? 

: Thanks in advance.

: Thomas

The NIS support in FreeBSD is fairly complete. rpc.ypupdated is only
available if you have Secure RPC, which FreeBSD doesn't currently support.
(Though with any luck it will before too long.) However it's not mornally
needed for plain NIS support. The getservent(3) code was updated to
support NIS before 2.1.5 was released. 2.1.6 and 2.2 will have it too.
(getservent(3) is for reading /etc/services). The getprotoent(3) code
in libc still doesn't have YP support, however the /etc/protocols file
is quite small and doesn't tend to change very often. I plan to add
NIS client support for this eventually though.

Everything else is there. FreeBSD has NIS client and server support
starting with 2.1.0. There were a few bug fixes for 2.1.5 (and there'll
be a few more for 2.1.6). 2.2.0 will have all new server support
(the existing code was written by other people anf ported to FreeBSD
by me, and is subject to the GPL; the new code is all written by me
and is covered by a BSD-style copyright).

Anyway. Assuming you know how to use NIS, you should be able to get
FreeBSD's NIS support to do what you want. One machine will need to
run ypserv and yppasswdd (or rpc.yppasswdd in 2.2.x) in order to be
a server. Both will need to be configured as clients. (The one which
is a server will be a client of itself, if that makes any sense.)
Read the passwd(5) man page to see how to set up /etc/master.passwd
for the client support. To create a server, do the following:

# domainname your.chosen.nis.domain.name
# cd /var/yp
# ln -s Makefile.dist Makefile (do this if /var/yp/Makefile doesn't exist)
# cp /etc/master.passwd .
# `hostname` > ypservers
# make
# ypserv
# yppasswdd -m /var/yp/master.passwd -s -f
# <edit /etc/sysconfig, and set the following things:

  defaultdomainname=your.chosen.nis.domain
  nis_serverflags="-dns"
  yppasswddflags="-m /var/yp/master.passwd -s -f"

  This will cause ypserv and yppasswdd to start each time the system
  is booted.>

This will create the NIS maps and start ypserv and yppasswdd. (On 2.2.x,
rpc.yppasswdd has different comand line switches, and there's also an
rpc.ypxfrd which is useful for sites with NIS master and slave servers.)

For the clients, just do this:

# domainname your.chosen.nis.domain.name
# ypbind -s
# <edit /etc/sysconfig and set the following things:

  defaultdomainname=your.chosen.nis.domain
  nis_clientflags="-s"

  This will cause ypbind to  start when the system is booted.>

Ultimately I hope to add NIS+ support, but this is a little ways off
yet. It probably won't appear until FreeBSD 3.0 (at least) and probably
later.

-Bill

--
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
 "If you're ever in trouble, go to the CTR. Ask for Bill. He will help you."
=============================================================================