From: css@tron.stx.com (Chris Shenton)
Subject: Re: How to autorebuild yp data in response to yppasswd? (SUMMARY)
Organization: Hughes/STX, Lanham, MD
Date: Thu, 19 Nov 1992 15:44:25 GMT

I got a bunch of responses to my query. A common complaint
was that there is a bug which ignores the first argument; injecting a
bogus argument is the solution there. The one I used simply specified
the ``-m passwd'' option with no ``DIR=whatever'' and specified the
DIR in the /var/yp/Makefile.

Following are the edited responses.

-- Chris

------- Start of digest -------
From: danba@pogo.wv.tek.com (Daniel J Balza)

This is my rc.local entry and it's been working fine for 5 months.

if [ -f /usr/etc/rpc.yppasswdd ]; then
        /usr/etc/rpc.yppasswdd /var/etc/passwd -m passwd
        echo 'starting yp passward deamon: rpc.yppasswdd'
fi

------------------------------
From: danba@darkstar.wv.tek.com

Good point about the Makefile, I forgot about that :-)).   Here is the 
passwd piece:

ALTDIR=/var/etc
.
.
.
.
passwd.time: $(ALTDIR)/passwd
        @(awk 'BEGIN { FS=":"; OFS="\t"; } /^[a-zA-Z0-9_]/ { print $$1, $$0 }' $
(ALTDIR)/passwd  $(CHKPIPE))| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/passwd.byname;
        @(awk 'BEGIN { FS=":"; OFS="\t"; } /^[a-zA-Z0-9_]/ { printf("%-10d ", $$
3); print $$0 }' $(ALTDIR)/passwd $(CHKPIPE))| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/pa
sswd.byuid;
        @touch passwd.time;
        @echo "updated passwd";
        @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOM) passwd.byname; fi
        @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOM) passwd.byuid; fi
        @if [ ! $(NOPUSH) ]; then echo "pushed passwd"; fi

------------------------------
From: Steve Hanson <hanson@pogo.fnal.gov>

Try something like the following:

/usr/etc/rpc.yppasswdd /var/etc/passwd -m passwd

A lot of SunOS releases won't work unless you use the full path name. 
Also, I don't think you can JUST use DIR= as an argument to m - 
You have to give the map name first.  So you could put in DIR=/var/etc/passwd
at the end, but you probably don't have to if you  define DIR in you
Makefile.

------------------------------
From: Hannu Visti <visti@cs.hut.fi>

	There is a bug in yppasswdd that causes the problem. It was
discovered a long time ago, but sun hasn't yet bothered to fix it. 
yppasswdd seems to ignore its first argument beginning with a -. I have here

rpc.yppasswdd /p/etc/yp/passwd -x -m passwd

in /etc/rc.local. It complains about -x being illegal, but it starts anyway,
and then -x gets ignored, not -m.

------------------------------
From: jc@raven.bu.edu (James F. Cameron)

There is a bug in rpc.yppasswdd as it ignores the first argument which
begins with a '-'.  The solution is to add '-nosingle' as the first
argument as this is the default behaivor.  

------------------------------
From: Jack Stewart <jack@laguna.ccsf.caltech.edu>

This is what we have setup on delilah:

 /usr/etc/rpc.yppasswdd /var/yp/passwd -m passwd;

You probably don't want to try to pass the DIR variable on the command
line to make with rpc.yppasswdd.  This is something that should be set
in the /var/yp/Makefile (I think that anything you passwd will just
get reset by the Makefile anyway).  If you want to have seperate
locations for some of your raw datafiles, that should also be set in
the /var/yp/Makefile.  Technically you don't need to specify the
'passwd' option after '-m' but we are just paranoid.

You should also make sure that ypxfrd and rpc.ypupdated is running on
your NIS server as well.

P.S.  We don't actually use yppasswd command for updating the password
files.  We use something called npasswd (npasswd does use the
ypasswd() system call though).  npasswd will check for stupid user
password tricks.  There is a program called ipasswd that is supposed
to be even better.

------------------------------
From: das@scotty (Dennis Shumaker)

I hope this helps.

/etc/rc.local

#  NIS (yellow pages) password daemon runs on master server only
#  DAS: 02/21/92

# my rc.local entry is alittle different than yours. I have passwd after
# -m option.

domainname `cat /etc/defaultdomain`

if [ -f /usr/etc/rpc.yppasswdd -a -d /var/yp/`domainname` ] ; then
       /usr/etc/rpc.yppasswdd /var/yp/passwd -m passwd DIR=/var/yp/`domainname`
fi

I keep my copy of the passwd file at /var/yp. You keep yours at
/var/etc .  I had to change the Makefile for NIS (/var/yp/Makefile) to
point to the passwd file at /var/yp.  I still use the /etc/passwd
file, but no users are in there.  All users passwords are in
/var/yp/passwd. Root is not in with the users - I left root in
/etc/passwd.

I put +: at the bottom of /etc/passwd so that is uses NIS. I run
ypbind on the server.  Below is what was changed in the Makefile.
note that vipw should not be used for users since vipw goes to
/etc/passwd

DIRP =/var/yp

passwd.time: $(DIRP)/passwd
        @(awk 'BEGIN { FS=":"; OFS="\t"; } /^[a-zA-Z0-9_]/ { print $$1, $$0 }' $(DIRP)/passwd  $(CHKPIPE))| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/passwd.byname;
        @(awk 'BEGIN { FS=":"; OFS="\t"; } /^[a-zA-Z0-9_]/ { printf("%-10d ", $$3); print $$0 }' $(DIRP)/passwd $(CHKPIPE))| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/passwd.byuid;
        @touch passwd.time;
        @echo "updated passwd";
        @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOM) passwd.byname; fi
        @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOM) passwd.byuid; fi
        @if [ ! $(NOPUSH) ]; then echo "pushed passwd"; fi

netid.time: $(DIRP)/passwd $(DIR)/group $(DIR)/hosts $(DIR)/netid
        @$(MKNETID) -q -p $(DIRP)/passwd -g $(DIR)/group -h $(DIR)/hosts -m $(DIR)/netid > .ypjunk;
        @$(MAKEDBM) .ypjunk $(YPDBDIR)/$(DOM)/netid.byname;
        @rm -f .ypjunk;
        @touch netid.time;
        @echo "updated netid";
        @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOM) netid.byname; fi
        @if [ ! $(NOPUSH) ]; then echo "pushed netid"; fi


Since I changed the Makefile I had to remake the maps for passwd

	make passwd

------- End of digest -------
--
-- Chris Shenton        css@tron.stx.com        Hughes/STX 301-794-5490
Newsgroups: comp.sys.sun.admin,comp.sys.sun.apps