免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4054 | 回复: 7
打印 上一主题 下一主题

NIS配置auto_direct问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-27 23:59 |只看该作者 |倒序浏览
在虚拟机上做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

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...

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

分别重启两台机器:

# 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.

没有man页面。请教各位兄弟,这是什么原因?

论坛徽章:
0
2 [报告]
发表于 2008-10-28 23:45 |只看该作者
太绕弯。。。你把/usr/share/man移到/usr/share/man2,然后从主nis上共享出来,希望通过本地的auto_direct来mount成/usr/share/man。在主的上面试了可以,从的上不行,是么?

把主nis和从nis的df -kF nfs的结果输出来看看?
或者你的/etc/mnttab。

论坛徽章:
0
3 [报告]
发表于 2008-10-29 10:44 |只看该作者
hosts文件好像也要修改,最后还要加一行,具体是什么,我搞忘了。你自己找一下吧。我以前配置过。auto_home这些都很正常。

论坛徽章:
0
4 [报告]
发表于 2008-10-30 09:47 |只看该作者

回复 #2 anfield 的帖子

是啊是啊,正是你说的情况。从nis机器里的mnttab里没有auto_direct,如下:

主nis机器:
# ypcat auto.direct
-ro     mysun90:/usr/share/man2
# 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
$ grep auto.direct /etc/mnttab
auto_direct     /usr/share/man  autofs  direct,nosuid,ignore,dev=3100004        1225330914
$


从nis机器:
# ypcat auto.direct
-ro     mysun90:/usr/share/man2
# su - user4
Sun Microsystems Inc.   SunOS 5.9       Generic January 2003
$ pwd
/home/user4
$ man ls
No manual entry for ls.
$ grep auto.direct /etc/mnttab
$

论坛徽章:
0
5 [报告]
发表于 2008-10-31 22:52 |只看该作者
在从nis上
看看下面的命令的输出

#ypwhich
#ypcat auto_direct

先用手工试试能不能mount上。
还可以到/var/adm下查查messages,看看有没有相关的错误信息。

论坛徽章:
0
6 [报告]
发表于 2008-11-01 00:01 |只看该作者

回复 #5 anfield 的帖子

手动mount正常。
# ypwhich
mysun90
# ypcat auto_direct
no such map in server's domain
# ypwhich -m
auto.direct mysun90
mail.byaddr mysun90
mail.aliases mysun90
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

论坛徽章:
0
7 [报告]
发表于 2008-11-01 03:39 |只看该作者
看看这个帖子有没有帮助
http://groups.google.com/group/c ... ad/f86beaae8db8aca7
基本上的意思就是NIS的auto_master map里不应该有"+auto_master",而只在NIS client端本地的auto_master中引用,用于调用NIS的map。

可以试试

论坛徽章:
0
8 [报告]
发表于 2008-11-01 13:10 |只看该作者

回复 #7 anfield 的帖子

非常感谢!!!问题已经得到解决。
# ypwhich
mysun90
# ypcat auto_direct
no such map in server's domain
# 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
     arguments   are   given,  the  arguments  are  first  sorted
# 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
     arguments   are   given,  the  arguments  are  first  sorted
$ exit
# ypwhich
mysun90
# ypcat auto_direct
no such map in server's domain
#
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP