1818IP-服务器技术教程,云服务器评测推荐,服务器系统排错处理,环境搭建,攻击防护等

当前位置:首页 - 运维 - 正文

君子好学,自强不息!

NIS配置auto_direct问题

2022-11-18 | 运维 | admin | 566°c
A+ A-

在虚拟机上做solaris9 NIS配置练习,有两台机器:mysun90(9.90)和mysun110(9.110)。现将配置过程贴下:

配置主nis服务器:

# hostname mysun90

# more /etc/hosts 127.0.0.1 localhost 192.168.9.90 mysun90 loghost 192.168.9.110 mysun110

# cd /var/yp

# cp Makefile Makefile.orig

# vi Makefile (去掉aliases) all: passwd group hosts ipnodes ethers networks rpc services protocols \ netgroup bootparams publickey netid netmasks c2secure \ timezone auto.master auto.home ageing \ auth.attr exec.attr prof.attr user.attr audit.user

# domainname mysun.com

# echo “mysun.com” > /etc/defaultdomain

# cd /etc

# touch ethers bootparams netgroup

# echo “GMT+08:00 mysun.com” > /etc/timezone

# more /etc/auto_master +auto_master /net -hosts -nosuid,nobrowse /home auto_home -nobrowse /xfn -xfn

# vi /etc/auto_home +auto_home * mysun90:/export/home/&

# echo “share/export/home” >> /etc/dfs/dfstab

# /etc/init.d/nfs.server start

# share – /export/home rw “”

# useradd -d /export/home/user4 -m user4

# vi /etc/passwd user4:401:1::/home/user4:/bin/sh

# vi /etc/shadow user4::::::::

# su – user4 Sun Microsystems Inc. SunOS 5.9 Generic January 2003

$ pwd /home/user4

$ exit

# cp /etc/nsswitch.nis /etc/nsswitch.conf

# ypinit -m

In order for NIS to operate sucessfully, we have to construct a list of the NIS servers.Please continue to add the names for YP servers in order of preference, one per line.When you are done with the list, type a <control D> or a return on a line by itself. next host to add:mysun90 next host to add:mysun110 next host to add:^D The current list of yp servers looks like this:

mysun90 mysun110

Is this correct?[y/n: y]y

Installing the YP database will require that you answer a few questions. Questions will all be asked at the beginning of the procedure.

Do you want this procedure to quit on non-fatal errors? [y/n: n]n OK, please remember to go back and redo manually whatever fails.If you don’t, some part of the system (perhaps the yp itself) won’t work. The yp domain directory is /var/yp/mysun.com There will be no further questions. The remainder of the procedure should take 5 to 10 minutes. Building /var/yp/mysun.com/ypservers… Running /var/yp /Makefile… updated passwd updated group updated hosts updated ipnodes updated ethers updated networks updated rpc updated services updated protocols updated netgroup updated bootparams updated publickey updated netid /usr/sbin/makedbm /etc/netmasks /var/yp/`domainname`/netmasks.byaddr; updated netmasks updated timezone updated auto.master updated auto.home updated ageing updated auth_attr updated exec_attr updated prof_attr updated user_attr updated audit_user

#p#

mysun90 has been set up as a yp master server without any errors.

If there are running slave yp servers, run yppush now for any data bases which have been changed.If there are no running slaves, run ypinit on those hosts which are to be slave servers.

# /usr/lib/netsvc/yp/ypstart starting NIS (YP server) services: ypserv ypbind ypxfrd rpc.yppasswdd rpc.ypupdated done.

# ypwhich -m audit_user mysun90 user_attr mysun90 prof_attr mysun90 exec_attr mysun90 auth_attr mysun90 ageing.byname mysun90 auto.home mysun90 auto.master mysun90 timezone.byname mysun90 netmasks.byaddr mysun90 netid.byname mysun90 bootparams mysun90 netgroup.byhost mysun90 netgroup.byuser mysun90 netgroup mysun90 protocols.byname mysun90 protocols.bynumber mysun90 services.byservicename mysun90 services.byname mysun90 rpc.bynumber mysun90 networks.byaddr mysun90 networks.byname mysun90 ethers.byname mysun90 ethers.byaddr mysun90 ipnodes.byaddr mysun90 publickey.byname mysun90 ipnodes.byname mysun90 hosts.byaddr mysun90 hosts.byname mysun90 group.bygid mysun90 group.byname mysun90 passwd.byuid mysun90 passwd.byname mysun90 ypservers mysun90

# ypwhich mysun90

# ypcat auto.home mysun90:/export/home/&

# ypcat hosts 127.0.0.1 localhost 192.168.9.110 mysun110 192.168.9.90 mysun90 loghost 192.168.9.90 mysun90 loghost

# ypcat passwd noaccess:NP:60002:60002:No Access User:/: nobody4:NP:65534:65534:SunOS 4.x Nobody:/: nobody:NP:60001:60001:Nobody:/: listen:*LK*:37:4:Network Admin:/usr/net/nls: daemon:NP:1:1::/: user4::101:1::/home/user4:/bin/sh smmsp:NP:25:25:SendMail Message Submission Program:/: nuucp:NP:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico uucp:NP:5:5:uucp Admin:/usr/lib/uucp: root:Xv9/n7/cT8jBo:0:1:Super-User:/:/sbin/sh sys:NP:3:3::/: bin:NP:2:2::/usr/bin: adm:NP:4:4:Admin:/var/adm: lp:NP:71:8:Line Printer Admin:/usr/spool/lp:

配置从nis服务器:

# hostname mysun110

# vi /etc/hosts 127.0.0.1 localhost 192.168.9.110 mysun110 loghost 192.168.9.90 mysun90

# domainname mysun.com

# cd /etc

# domainname > defaultdomain

# ypinit -c

In order for NIS to operate sucessfully, we have to construct a list of the NIS servers.Please continue to add the names for YP servers in order of preference, one per line.When you are done with the list, type a <control D> or a return on a line by itself. next host to add:mysun90 next host to add:mysun110 next host to add:^D The current list of yp servers looks like this:

mysun90 mysun110

Is this correct?[y/n: y]y

# cp nsswitch.nis nsswitch.conf

# /usr/lib/netsvc/yp/ypstart starting NIS (YP server) services: ypbind done.

# ypwhich mysun90

# ypinit -s mysun90

Installing the YP database will require that you answer a few questions. Questions will all be asked at the beginning of the procedure.

Do you want this procedure to quit on non-fatal errors? [y/n: n]n OK, please remember to go back and redo manually whatever fails.If you don’t, some part of the system (perhaps the yp itself) won’t work. The yp domain directory is /var/yp/mysun.com There will be no further questions. The remainder of the procedure should take a few minutes, to copy the data bases from mysun90. Transferring audit_user… Transferring user_attr… Transferring prof_attr… Transferring exec_attr… Transferring auth_attr… Transferring ageing.byname… Transferring auto.home… Transferring auto.master… Transferring timezone.byname… Transferring netmasks.byaddr… Transferring netid.byname… Transferring bootparams… Transferring netgroup.byhost… Transferring netgroup.byuser… Transferring netgroup… Transferring protocols.byname… Transferring protocols.bynumber… Transferring services.byservicename… Transferring services.byname… Transferring rpc.bynumber… Transferring networks.byaddr… Transferring networks.byname… Transferring ethers.byname… Transferring ethers.byaddr… Transferring ipnodes.byaddr… Transferring publickey.byname… Transferring ipnodes.byname… Transferring hosts.byaddr… Transferring hosts.byname… Transferring group.bygid… Transferring group.byname… Transferring passwd.byuid… Transferring passwd.byname… Transferring ypservers…

#p#

mysun110’s nis data base has been set up

without any errors. #

# /usr/lib/netsvc/yp/ypstop

# /usr/lib/netsvc/yp/ypstart starting NIS (YP server) services: ypserv ypbind done.

# ypwhich -m audit_user mysun90 user_attr mysun90 prof_attr mysun90 exec_attr mysun90 auth_attr mysun90 ageing.byname mysun90 auto.home mysun90 auto.master mysun90 timezone.byname mysun90 netmasks.byaddr mysun90 netid.byname mysun90 bootparams mysun90 netgroup.byhost mysun90 netgroup.byuser mysun90 netgroup mysun90 protocols.byname mysun90 protocols.bynumber mysun90 services.byservicename mysun90 services.byname mysun90 rpc.bynumber mysun90 networks.byaddr mysun90 networks.byname mysun90 ethers.byname mysun90 ethers.byaddr mysun90 ipnodes.byaddr mysun90 publickey.byname mysun90 ipnodes.byname mysun90 hosts.byaddr mysun90 hosts.byname mysun90 group.bygid mysun90 group.byname mysun90 passwd.byuid mysun90 passwd.byname mysun90 ypservers mysun90

# ypcat hosts 127.0.0.1 localhost 192.168.9.110 mysun110 192.168.9.90 mysun90 loghost 192.168.9.90 mysun90 loghost

# ypcat -k ypservers mysun110 mysun90

# su – user4 No directory!

重启两台机器后继续。

回到主nis服务器:

# cd /var/yp

# vi Makefile

——————–(目标all域)

all: passwd group hosts ipnodes ethers networks rpc services protocols \ netgroup bootparams publickey netid netmasks c2secure \ timezone auto.master auto.home ageing \ auth.attr exec.attr prof.attr user.attr audit.user auto.direct

—————————————————————(第3域) auto.direct.time:$(DIR)/auto_direct -@if [ -f $(DIR)/auto_direct ]; then \ sed -e “/^#/d” -e s/#.*$$// $(DIR)/auto_direct \ | $(MAKEDBM) – $(YPDBDIR)/$(DOM)/auto.direct; \ touch auto.direct.time; \ echo “updated auto.direct”; \ if [ ! $(NOPUSH) ]; then \ $(YPPUSH) auto.direct; \ echo “pushed auto.direct”; \ else \ : ; \ fi \ else \ echo “couldn’t find $(DIR)/auto_direct”; \ fi —————————————————————(第4域)

auto.master: auto.master.time auto.home: auto.home.time auto.direct: auto.direct.time auth.attr:auth.attr.time

$(DIR)/auto_master: $(DIR)/auto_home: $(DIR)/auto_direct: $(PWDIR)/shadow:

# vi /etc/auto_master +auto_master /net -hosts -nosuid,nobrowse /home auto_home -nobrowse /xfn -xfn /- auto_direct -nosuid

# vi /etc/auto_direct /usr/share/man-ro mysun90:/usr/share/man2

在两台机器上进行:

# mv /usr/share/man /usr/share/man2

回到主nis服务器:

# echo “share -o ro /usr/share/man2” >> /etc/dfs/dfstab

# shareall

# share – /export/home rw “” – /usr/share/man2 ro “”

# /usr/lib/netsvc/yp/ypstop

# /usr/lib/netsvc/yp/ypstart starting NIS (YP server) services: ypserv ypbind ypxfrd rpc.yppasswdd rpc.ypupdated done.

# cd /var/yp

#/usr/ccs/bin/make updated netid pushed netid updated auto.master pushed auto.master updated auto.direct ^C *** auto.direct.time removed.

切换到从nis服务器)

# /usr/lib/netsvc/yp/ypxfr auto.direct

# ypwhich mysun90

回到主nis服务器)

# cd /var/yp

#/usr/ccs/bin/make updated netid pushed netid updated auto.direct pushed auto.direct

#p#

分别重启两台机器:

# init 6

回到主nis服务器:

# su – user4 Sun Microsystems Inc. SunOS 5.9 Generic January 2003 $ pwd /home/user4 $ man ls Reformatting page.Please Wait… done

User Commands ls(1)

NAME ls – list contents of directory

SYNOPSIS /usr/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file…]

/usr/xpg4/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file…]

DESCRIPTION For each file that is a directory, ls lists the contentsof thedirectory.Foreach file that is an ordinary file, ls repeats its name and any otherinformationrequested.The output is sorted alphabetically by default. When no argument is given, the currentdirectoryislisted.Whenseveral 。。。 直接映射正常。

回到从nis服务器:

# su – user4 Sun Microsystems Inc. SunOS 5.9 Generic January 2003 $ pwd /home/user4 $ man ls No manual entry for ls.

本文来源:1818IP

本文地址:https://www.1818ip.com/post/10110.html

免责声明:本文由用户上传,如有侵权请联系删除!

发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。