NIS配置auto_direct问题
创始人
2024-06-07 08:41:14
0

在虚拟机上做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[[5983]]: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
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
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 contents  of
     the  directory.  For  each file that is an ordinary file, ls
     repeats its name and any other  information  requested.  The
     output is sorted alphabetically by default. When no argument
     is given, the current  directory  is  listed.  When  several
。。。 直接映射正常。

回到从nis服务器:

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

【编辑推荐】

  1. 在RHEL 5中配置NIS服务器端及客户端
  2. RHEL上NIS网络信息服务配置实例讲解
  3. RHEL5.1主/从NIS服务器配置及测试 

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
着眼MAC地址,解救无法享受D... 在安装了DHCP服务器的局域网环境中,每一台工作站在上网之前,都要先从DHCP服务器那里享受到地址动...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...