要求
NIS客户端自动挂载/home目录
前提
====
1)两台电脑
server:192.168.1.2
clinet:192.168.1.117
2)服务器端(server)假定已安装包:ypserv,portmap,nfs等
客户端(server)假定已安装包:ypbind,portmap,autofs等
配置
====
一.服务器(server)端配置
1)ypserv配置
1.修改/etc/sysconfig/network文件
echo "NISDOMAIN=myNIS" >> /etc/sysconfig/network
2.修改/var/yp/Makefile(可选)
all: passwd group hosts (其后内容可以注释掉)
3.开启portmap,ypserv服务
chkconfig --level 345 portmap on
service portmap start
chkconfig --level 345 ypserv on
service ypserv start
4.建nis主服务器
注:按control+D
[root@test ~]# /usr/lib/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. test.example.com is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the
list, type a <control D>.
next host to add: test.example.com
next host to add:
The current list of NIS servers looks like this:
test.example.com
Is this correct? [y/n: y] y
We need a few minutes to build the databases...
Building /var/yp/myNIS/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/myNIS'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
gmake[1]: Leaving directory `/var/yp/myNIS'
test.example.com has been set up as a NIS master server.
Now you can run ypinit -s test.example.com on all slave server.
2)建立/home目录软件链接
ln -s /home /rhome
3)配置导出文件
1.开启nfs服务
chkconfig --level 345 nfs on
service nfs restart
2.修改/etc/exports文件
echo "/rhome 192.168.1.117(rw,sync)
注:rw就是导出文件系统对主机192.168.1.117可写;
192.168.1.117(rw,...与192.168.1.117 (rw,... {后面一个多一个空格}
3.生效exports
exportfs -r
二.客户(client)端配置
1)ypbind配置
1.开启portmap,autofs,ypbind
chkconfig --level 345 portmap on
service portmap start
chkconfig --level 345 autofs on
service autofs start
chkconfig --level 345 ypbind on
service ypbind start
2.nis客户端配置
authconfig
Domain: myNIS
Server: 192.168.1.2
3.验证帐户信息
ypcat passwd
2)自动挂载导出文件系统
1.修改/etc/auto.master
echo "/rhome /etc/auto.rhome --timeout=60" >> /etc/auto.master
2.修改/etc/auto.rhome
echo "* -rw,soft 192.168.1.1:/rhome/&" >> /etc/auto.rhome
注:此处rw与上面rw具体相同含义,均指可写文件系统
三.测试
server上定义mail01,mail02用户,在client上用mail01/mail02登录,没有错误:说明共享主目录成功,mail01/mail02登录后,可在自己的主目录写(取决于上面两处注红色的"rw")
测试成功!!!!
nis+aufs+pam案例:
阅读(2140) | 评论(0) | 转发(0) |