autofs设置完毕后,如果往挂载点写数据,总是会提示权限不够;
问题详细描述:
1、进入挂载点之后,只显示的是auto.master中设置的挂载点,里面没有NFS上所设置的挂载目录中的内容;
2、通过touch命令无法在该挂载点中写入数据,有如下提示:
[root@autofs ~]# cd /
[root@autofs /]# ls
autofs_mount cgroup etc lib64 misc opt sbin sys var
bin data home lost+found mnt proc selinux tmp
boot dev lib media net root srv usr
[root@autofs /]# cd misc/
[root@autofs misc]# ls
test1
[root@autofs misc]# cd test1/
[root@autofs test1]# ls
[root@autofs test1]# mkdir skdjf
mkdir: 无法创建目录"skdjf": 权限不够
[root@autofs test1]# touch sldjf
touch: 无法创建"sldjf": 权限不够
[root@autofs test1]#
3、配置过程
配置auto.master
/misc/test1 /etc/auto.misc
配置auto.misc
test1 -fstype=nfs,rw,soft,intr 192.168.0.122:/home/nfs_test/test1
4、在auto.master的配置过程中,也试过配置auto.nfs的方式,同样不管用,报同样的错误;
5、分析
通过执行结果可以看出,配置完毕之后auto.master文件肯定是起作用了的,因为启动服务后就生成了文件配置中对应的目录了,但是进入该目录后没有看到NFS挂载目录的文件,同时也不能往该目录中写入数据,因此怀疑,生成的这个目录只是作为一个挂载点,还没挂载nfs目录,类似与这个挂载点现在是一个文件,一个只读文件,无法写入数据,因此怀疑auto.master文件中所写的不管是auto.misc还是auto.nfs,这种文件都没有起作用,那么是不是缺少一个动作去挂载这个目录呢,是否还缺少一个服务或者一个脚本需要执行一下呢?
6、问题解决
----------------------------------------------------------------------------------------------------------------------------------------------
autofs+nfs配置过程
环境:
Centos6.5_X86_64
server:192.168.0.122
client:192.168.0.104
1、建立NFS:
[root@nis-server1 /]# vim /etc/exports
#/rhome 192.168.0.0/24(rw,no_root_squash)
#/cluster 192.168.0.0/24(rw,no_root_squash)
#/tmp/test 192.168.0.0/24(rw,no_root_squash)
#/home/nfs_test/tmp 192.168.0.0/24(rw,no_root_squash)
#/home/nfs_test/test3 192.168.0.0/24(rw,no_root_squash)
#/home/nfs_test/nfs 192.168.0.0/24(ro) *(ro,all_squash)
#/home/nfs_test/upload 192.168.0.0/24(rw,all_squash,anonuid=210,anongid=210)
#/home/nfs_test/andy 192.168.0.0/24(rw)
#/home/nfs_test/test2 192.168.0.0/24(rw,no_root_squash)
#/home/nfs_test/test1 192.168.0.0/24(rw,no_root_squash)
/home/nfs_test/test1 192.168.0.0/24(rw,no_root_squash)
2、开启NFS服务:
[root@nis-server1 /]# service nfs restart
关闭 NFS 守护进程: [确定]
关闭 NFS mountd: [确定]
关闭 NFS quotas: [确定]
关闭 NFS 服务: [确定]
Shutting down RPC idmapd: [确定]
启动 NFS 服务: [确定]
关掉 NFS 配额: [确定]
启动 NFS mountd: [确定]
启动 NFS 守护进程: [确定]
正在启动 RPC idmapd: [确定]
[root@nis-server1 /]#
3、查看是否设置成功:
[root@nis-server1 /]# showmount -e localhost
Export list for localhost:
/home/nfs_test/test1 192.168.0.0/24
[root@nis-server1 /]#
4、配置auto.master
[root@autofs /]# vim /etc/auto.master
#
#/misc /etc/auto.misc
#/misc/test1 /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#auto mount test
#/rhome /etc/auto.nfs
#/nfs_test /etc/auto.nfs
#/autofs_mount /etc/auto.nfs
#/rhome /etc/auto.nfs
#
/lilong /etc/auto.nfs
5、建立auto.nfs并设置
[root@autofs /]# vim /etc/auto.nfs
#rhome -rw,bg,soft,rsize=32768,wsize=32768 192.168.0.122:/rhome
#nfs_test -rw,bg,soft,rsize=32768,wsize=32768 192.168.0.122:/tmp/test
#test1 -fstype=nfs,rw 192.168.0.122:/home/nfs_test/test1
#* -rw,soft,intr 192.168.0.122:/home/nfs_test/test1/&
#
testing 192.168.0.122:/home/nfs_test/test1
~
6、重启auto.nfs服务
[root@autofs /]# service autofs restart
停止 automount: [确定]
正在启动 automount: [确定]
[root@autofs /]#
7、查看当前挂载状态
[root@autofs /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 40G 9.9G 28G 27% /
tmpfs 932M 76K 932M 1% /dev/shm
/dev/sda1 52G 180M 49G 1% /data
[root@autofs /]#
8、进入挂载点并查看挂载点内容
[root@autofs /]# cd lilong/
[root@autofs lilong]# ls
[root@autofs lilong]#
9、进入auto.nfs设置的挂载点次目录并查看次目录中的内容
[root@autofs lilong]# cd testing
[root@autofs testing]# ls
lsj slkdjf
[root@autofs testing]#
10、查看系统挂载信息
[root@autofs testing]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 40G 9.9G 28G 27% /
tmpfs 932M 76K 932M 1% /dev/shm
/dev/sda1 52G 180M 49G 1% /data
192.168.0.122:/home/nfs_test/test1 40G 9.9G 28G 27% /lilong/testing
[root@autofs testing]#
重新整理NIS+NFS+AUTOFS
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
1、设置域名与启动端口号
[root@nis-server1 /]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=nis-server1
NISDOMAIN=ocean-peak
YPSERV_ARGS="-p 1011"
2、配置/etc/ypserv.conf
[root@nis-server1 /]# vim /etc/ypserv.conf
# The following, when uncommented, will give you shadow like passwords.
# Note that it will not work if you have slave NIS servers in your
# network that do not run the same server as you.
# Host : Domain : Map : Security
#
# * : * : passwd.byname : port
# * : * : passwd.byuid : port
# Not everybody should see the shadow passwords, not secure, since
# under MSDOG everbody is root and can access ports < 1024 !!!
* : * : shadow.byname : port
* : * : passwd.adjunct.byname : port
# If you comment out the next rule, ypserv and rpc.ypxfrd will
# look for YP_SECURE and YP_AUTHDES in the maps. This will make
# the security check a little bit slower, but you only have to
# change the keys on the master server, not the configuration files
# on each NIS server.
# If you have maps with YP_SECURE or YP_AUTHDES, you should create
# a rule for them above, that‘s much faster.
* : * : * : none
3、查看本机IP,更改/etc/hosts
[root@nis-server1 /]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.106 nis-server1
4、固定yppasswd服务启动的端口号
[root@nis-server1 /]# vim /etc/sysconfig/yppasswdd
# The passwd and shadow files are located under the specified
# directory path. rpc.yppasswdd will use these files, not /etc/passwd
# and /etc/shadow.
#ETCDIR=/etc
# This options tells rpc.yppasswdd to use a different source file
# instead of /etc/passwd
# You can‘t mix usage of this with ETCDIR
#PASSWDFILE=/etc/passwd
# This options tells rpc.yppasswdd to use a different source file
# instead of /etc/passwd.
# You can‘t mix usage of this with ETCDIR
#SHADOWFILE=/etc/shadow
# Additional arguments passed to yppasswd
YPPASSWDD_ARGS="-p 1012"
5、启动NIS相关服务
[root@nis-server1 /]# service ypserv start
设置 NIS 域名 ocean-peak: [确定]
启动 YP 服务器的服务: [确定]
[root@nis-server1 /]# service yppasswdd start
启动 YP 口令服务: [确定]
[root@nis-server1 /]# chkconfig ypserv on
[root@nis-server1 /]# chkconfig yppasswdd on
[root@nis-server1 /]#
6、检查服务启动结果
[root@nis-server1 /]# rpcinfo -p localhost
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 33941 status
100024 1 tcp 47918 status
100004 2 udp 1011 ypserv
100004 1 udp 1011 ypserv
100004 2 tcp 1011 ypserv
100004 1 tcp 1011 ypserv
100009 1 udp 614 yppasswdd
[root@nis-server1 /]# rpcinfo -u localhost ypserv
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting
[root@nis-server1 /]#
7、建立NIS用户
[root@nis-server1 /]# useradd -u 1001 nisuser1
[root@nis-server1 /]# useradd -u 1002 nisuser2
8、更改NIS用户密码
[root@nis-server1 /]# echo password |passwd --stdin nisuser1
更改用户 nisuser1 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
[root@nis-server1 /]# echo password |passwd --stdin nisuser2
更改用户 nisuser2 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
[root@nis-server1 /]#
9、数据库生成用户信息
[root@nis-server1 /]# /usr/lib64/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. nis-server1 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: nis-server1
next host to add:
The current list of NIS servers looks like this:
nis-server1
Is this correct? [y/n: y]
We need a few minutes to build the databases...
Building /var/yp/ocean-peak/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/ocean-peak‘
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/ocean-peak‘
nis-server1 has been set up as a NIS master server.
Now you can run ypinit -s nis-server1 on all slave server.
[root@nis-server1 /]#
10、设置NFS用户目录,并增加用户设置密码
[root@nis-server1 /]# mkdir rhome
[root@nis-server1 /]# useradd -u 1003 -d /rhome/nisuser-nfs-1 nisuser-nfs1
[root@nis-server1 /]# useradd -u 1004 -d /rhome/nisuser-nfs-2 nisuser-nfs2
[root@nis-server1 /]# echo password|passwd --stdin nisuser-nfs1
更改用户 nisuser-nfs1 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
[root@nis-server1 /]# echo password|passwd --stdin nisuser-nfs2
更改用户 nisuser-nfs2 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
[root@nis-server1 /]#
11、更新数据库
[root@nis-server1 /]# /usr/lib64/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. nis-server1 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: nis-server1
next host to add:
The current list of NIS servers looks like this:
nis-server1
Is this correct? [y/n: y]
We need a few minutes to build the databases...
Building /var/yp/ocean-peak/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/ocean-peak‘
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/ocean-peak‘
nis-server1 has been set up as a NIS master server.
Now you can run ypinit -s nis-server1 on all slave server.
[root@nis-server1 /]#
12、重启服务
[root@nis-server1 /]# service ypserv restart
停止 YP 服务器的服务: [确定]
启动 YP 服务器的服务: [确定]
[root@nis-server1 /]# service yppasswdd restart
停止 YP 口令服务: [确定]
启动 YP 口令服务: [确定]
[root@nis-server1 /]#
13、设置/etc/export
[root@nis-server1 /]# vim /etc/exports
/rhome 192.168.0.0(rw,no_root_squash)
14、重启NFS服务
[root@nis-server1 /]# service nfs restart
关闭 NFS 守护进程: [失败]
关闭 NFS mountd: [失败]
关闭 NFS quotas: [失败]
Shutting down RPC idmapd: [失败]
启动 NFS 服务: [确定]
关掉 NFS 配额: [确定]
启动 NFS mountd: [确定]
启动 NFS 守护进程: [确定]
正在启动 RPC idmapd: [确定]
[root@nis-server1 /]#
15、本地查看NFS是否设置成功
[root@nis-server1 /]# showmount -e localhost
Export list for localhost:
/rhome 192.168.0.0
[root@nis-server1 /]#
16、在客户机查看server NFS信息
[root@nis-client1 桌面]# hostname
nis-client1
[root@nis-client1 桌面]# showmount -e 192.168.0.106
Export list for 192.168.0.106:
/rhome 192.168.0.0
[root@nis-client1 桌面]#
为配合NIS使用,现将export内容改为如下:
/rhome/nisuser-nfs-1 192.168.0.0/24(rw,no_root_squash)
/rhome/nisuser-nfs-2 192.168.0.0/24(rw,no_root_squash)
17、设置auto.master
[root@nis-client1 桌面]# vim /etc/auto.master
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#automount 192.168.0.106(nis users)
/rhome /etc/auto.nfs
#
18、设置auto.nfs
[root@nis-client1 桌面]# vim /etc/auto.nfs
rhome 192.168.0.106:/rhome
为配合NIS用户,现将auto.nfs配置更改为如下:
nisuser-nfs-1 192.168.0.106:/rhome/nisuser-nfs-1
nisuser-nfs-2 192.168.0.106:/rhome/nisuser-nfs-2
19、启动autofs服务
[root@nis-client1 桌面]# service autofs restart
停止 automount: [确定]
正在启动 automount: [确定]
[root@nis-client1 桌面]#
20、开启并配置NIS
[root@nis-client1 桌面]# setup
选择验证配置,并运行;
21、选中NIS,并执行下一步:
22、填写域名和服务器IP,并确定:
23、自动启动服务并绑定NIS服务;
24、退出:
25、查看设置的NIS用户名(server端)
[root@nis-server1 桌面]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
hacluster:x:189:189:cluster user:/home/hacluster:/sbin/nologin
rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
pegasus:x:66:65:tog-pegasus OpenPegasus WBEM/CIM services:/var/lib/Pegasus:/sbin/nologin
cimsrvr:x:134:134:tog-pegasus OpenPegasus WBEM/CIM services:/var/lib/Pegasus:/sbin/nologin
abrt:x:173:173::/etc/abrt:/sbin/nologin
bacula:x:133:133:Bacula Backup System:/var/spool/bacula:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
hsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
rtkit:x:499:496:RealtimeKit:/proc:/sbin/nologin
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
saslauth:x:498:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
dovecot:x:97:97:Dovecot IMAP server:/usr/libexec/dovecot:/sbin/nologin
dovenull:x:497:494:Dovecot‘s unauthorized user:/usr/libexec/dovecot:/sbin/nologin
amandabackup:x:33:6:Amanda user:/var/lib/amanda:/bin/bash
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
tomcat:x:91:91:Apache Tomcat:/usr/share/tomcat6:/sbin/nologin
ricci:x:140:140:ricci daemon user:/var/lib/ricci:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
memcached:x:496:493:Memcached daemon:/var/run/memcached:/sbin/nologin
radvd:x:75:75:radvd user:/:/sbin/nologin
qemu:x:107:107:qemu user:/:/sbin/nologin
dhcpd:x:177:177:DHCP server:/:/sbin/nologin
pulse:x:495:491:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
stap-server:x:155:155:Systemtap Compile Server:/var/lib/stap-server:/sbin/nologin
piranha:x:60:60::/etc/sysconfig/ha:/sbin/nologin
xguest:x:500:500:Guest:/home/xguest:/bin/bash
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
mailman:x:41:41:GNU Mailing List Manager:/usr/lib/mailman:/sbin/nologin
webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
arpwatch:x:77:77::/var/lib/arpwatch:/sbin/nologin
quagga:x:92:92:Quagga routing suite:/var/run/quagga:/sbin/nologin
luci:x:141:141:luci high availability management application:/var/lib/luci:/sbin/nologin
ident:x:98:98::/:/sbin/nologin
squid:x:23:23::/var/spool/squid:/sbin/nologin
uuidd:x:494:486:UUID generator helper daemon:/var/lib/libuuid:/sbin/nologin
nslcd:x:65:55:LDAP Client User:/:/sbin/nologin
cyrus:x:76:12:Cyrus IMAP Server:/var/lib/imap:/sbin/nologin
ldap:x:55:55:LDAP User:/var/lib/ldap:/sbin/nologin
haproxy:x:188:188::/var/lib/haproxy:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
radiusd:x:95:95:radiusd user:/home/radiusd:/sbin/nologin
nisuser1:x:1001:1001::/home/nisuser1:/bin/bash
nisuser2:x:1002:1002::/home/nisuser2:/bin/bash
nisuser-nfs1:x:1003:1003::/rhome/nisuser-nfs-1:/bin/bash
nisuser-nfs2:x:1004:1004::/rhome/nisuser-nfs-2:/bin/bash
用户为nisuser-nfs1和nis-nfs2
26、注销系统,使用NIS用户登录客户机:
[nisuser-nfs1@nis-client1 桌面]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 40G 9.8G 28G 27% /
tmpfs 932M 168K 932M 1% /dev/shm
/dev/sda1 52G 180M 49G 1% /data
192.168.0.106:/rhome/nisuser-nfs-1 40G 9.9G 28G 27% /rhome/nisuser-nfs-1
[nisuser-nfs1@nis-client1 桌面]$
27、注销系统,使用nisuser-nfs2登录:
[nisuser-nfs2@nis-client1 桌面]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 40G 9.8G 28G 27% /
tmpfs 932M 244K 932M 1% /dev/shm
/dev/sda1 52G 180M 49G 1% /data
192.168.0.106:/rhome/nisuser-nfs-1 40G 9.9G 28G 27% /rhome/nisuser-nfs-1
192.168.0.106:/rhome/nisuser-nfs-2 40G 9.9G 28G 27% /rhome/nisuser-nfs-2
[nisuser-nfs2@nis-client1 桌面]$
注释:发现一个问题,当nisuser-nfs1注销后用nisuser-nfs2登录时发现nisuser-nfs1的目录还在,解决办法可以是更改/etc/sysconfig/autofs中的TIMEOUT=,默认是300,可以设置的尽可能小,使得nisuser-nfs1注销的同时其目录页断开连接,另一个办法就是设置权限,在服务器/etc/export中指定目录的所属用户即可;
28、更改nisuser-nfs1和nisuser-nfs2用户的密码:
[root@nis-server1 桌面]# echo root123 |passwd --stdin nisuser-nfs1
更改用户 nisuser-nfs1 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
[root@nis-server1 桌面]# echo root123 |passwd --stdin nisuser-nfs2
更改用户 nisuser-nfs2 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
[root@nis-server1 桌面]# /usr/lib64/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. nis-server1 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: nis-server1
next host to add:
The current list of NIS servers looks like this:
nis-server1
Is this correct? [y/n: y]
We need a few minutes to build the databases...
Building /var/yp/ocean-peak/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/ocean-peak‘
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/ocean-peak‘
nis-server1 has been set up as a NIS master server.
Now you can run ypinit -s nis-server1 on all slave server.
[root@nis-server1 桌面]#
29、client更改/etc/sysconfig/autofs中TIMEOUT设置成TIMEOUT=3;
30、使用nisuser-nfs1登录:
[nisuser-nfs1@nis-client1 桌面]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 40G 9.9G 28G 27% /
tmpfs 932M 244K 932M 1% /dev/shm
/dev/sda1 52G 180M 49G 1% /data
192.168.0.106:/rhome/nisuser-nfs-1 40G 9.9G 28G 27% /rhome/nisuser-nfs-1
[nisuser-nfs1@nis-client1 桌面]$
31、使用nisuser-nfs2登录:
[nisuser-nfs2@nis-client1 桌面]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 40G 9.9G 28G 27% /
tmpfs 932M 244K 932M 1% /dev/shm
/dev/sda1 52G 180M 49G 1% /data
192.168.0.106:/rhome/nisuser-nfs-2 40G 9.9G 28G 27% /rhome/nisuser-nfs-2
[nisuser-nfs2@nis-client1 桌面]$
由此发现更改了TIMEOUT后下一个用户登录后看不到上一个用户的目录;
32、试用nisuser-nfs2的用户cd nisuser-nfs1的目录:
[nisuser-nfs2@nis-client1 桌面]$ cd /rhome/
[nisuser-nfs2@nis-client1 rhome]$ ls
nisuser-nfs-2
[nisuser-nfs2@nis-client1 rhome]$ cd nisuser-nfs-1
bash: cd: nisuser-nfs-1: 权限不够
[nisuser-nfs2@nis-client1 rhome]$
目的达到。
本文出自 “诗意人生” 博客,请务必保留此出处http://linuxleo.blog.51cto.com/3394274/1661574
原文地址:http://linuxleo.blog.51cto.com/3394274/1661574