NIS setup

Emiel Kollof coolvibe at hackerheaven.org
Thu Dec 15 02:06:12 PST 2005


On Wednesday 14 December 2005 20:21, Chuck Tuffli wrote:
> Hi -
>
> I'm trying to setup a NIS client for the first time and am having some
> trouble. I used an older FreeBSD article as a guide

[snip]

> sldev12-l# ypcat passwd
> ypcat: no such map passwd.byname. reason: Can't bind to server which
> serves this domain
> sldev12-l# rpcinfo -p
>    program vers proto   port
>     100000    2   tcp    111  portmapper
>
> Other clients (Sun/Linux) have no trouble connecting to the server.
> Thanks for any advice.

Are you running ypbind? Make sure that you do. rpcinfo should report that 
ypbind is running.

Do you have nis_client_enable="YES" and nis_yppasswdd_enable="YES" in 
your /etc/rc.conf? (yppasswd might not be needed, but I think it's handy).

Oh, attached is a patch for the Makefile in /var/yp that will also create a 
shadow map if you ever want to use a FreeBSD or DragonFly NIS server with 
Linux clients (or other systems that expect a shadow map). 

Cheers,
Emiel
-- 
When I was a boy I was told that anyone could become President.
Now I'm beginning to believe it.
		-- Clarence Darrow
--- Makefile.dist	2005-11-30 12:23:18.000000000 +0100
+++ Makefile	2004-02-17 11:37:56.000000000 +0100
@@ -1,8 +1,7 @@
-#
+
 # Makefile for the NIS databases
 #
 # $FreeBSD: src/usr.sbin/ypserv/Makefile.yp,v 1.28.2.3 2001/05/18 18:28:02 gshapiro Exp $
-# $DragonFly: src/usr.sbin/ypserv/Makefile.yp,v 1.3 2004/01/08 18:39:19 asmodai Exp $
 #
 # This Makefile should only be run on the NIS master server of a domain.
 # All updated maps will be pushed to all NIS slave servers listed in the
@@ -28,7 +27,7 @@
 # non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX,
 # etc...) will only work properly in 'unsecure' mode.
 # 
-#UNSECURE = "True"
+UNSECURE = "True"
 
 # The following line encodes the YP_INTERDOMAIN key into the hosts.byname
 # and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve
@@ -80,7 +79,7 @@
 
 # These are the files from which the NIS databases are built. You may edit
 # these to taste in the event that you wish to keep your NIS source files
-# separate from your NIS server's actual configuration files. Note that the
+# seperate from your NIS server's actual configuration files. Note that the
 # NIS passwd and master.passwd files are stored in /var/yp: the server's
 # real password database is not used by default. However, you may use
 # the real /etc/passwd and /etc/master.passwd files by:
@@ -188,7 +187,7 @@
 publickey: publickey.byname
 aliases:   mail.aliases
 
-master.passwd:	master.passwd.byname master.passwd.byuid
+master.passwd:	master.passwd.byname master.passwd.byuid shadow.byname shadow.byuid
 
 #
 # This is a special target used only when doing in-place updates with
@@ -468,7 +467,7 @@
 	@if [ ! $(UNSECURE) ]; then \
 	$(RCAT) $(MASTER) | \
 	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
-		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
+		print $$1":x:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
 		> $(PASSWD) ; \
 	else $(RCAT) $(MASTER) | \
 	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
@@ -568,6 +567,36 @@
 .endif
 
 
+shadow.byname: $(MASTER)
+	@echo "Updating $@..."
+.if ${MASTER} == "/dev/null"
+.else
+	$(CAT) $(MASTER) | \
+	$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
+		print $$1"\t"$$1":"$$2":12345:0:99999:7:::" }' $^ \
+		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
+		$(RMV) $(TMP) $@
+	@$(DBLOAD) -c
+	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
+	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map. " ; fi
+.endif 
+
+
+shadow.byuid: $(MASTER) 
+	@echo "Updating $@..."
+.if ${MASTER} == "/dev/null"
+.else
+	$(CAT) $(MASTER) | \
+	$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
+		print $$3"\t"$$0 }' $^ \
+		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
+		$(RMV) $(TMP) $@
+		@$(DBLOAD) -c
+	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
+	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map. " ; fi 
+.endif
+ 
+ 
 amd.host: $(AMDHOST)
 	@echo "Updating $@..."
 	$(CAT) $(AMDHOST) | \
Attachment:
pgp00008.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00008.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20051215/817faf0b/attachment-0015.obj>


More information about the Users mailing list