Autofs+NFS+NIS实现智能挂载(2)

这样我们在客户端就能利用user2进行登录了 我们希望把服务器端的用户家目录自动挂载到客户端机器上 首先把服务器端的家目录通过nfs共享

[root@localhost yp]# vim /etc/exports

/nishome 192.168.145.0/24(ro)

[root@localhost yp]# exportfs –rv

[root@localhost yp]# mkdir /nishome

[root@localhost yp]# useradd -d /nishome/user3 user3

[root@localhost yp]# passwd user3

[root@localhost yp]# service nfs start

客户端配置

手动挂载

[root@localhost ~]#mkdir /nishome

[root@localhost ~]# mount 192.168.145.100:/nishome /nishome
[root@localhost ~]# mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hdc on /mnt/cdrom type iso9660 (ro)
192.168.145.100:/nishome on /nishome type nfs (rw,addr=192.168.145.100)
[root@localhost ~]# cd /nishome/
[root@localhost nishome]# ll
总计 8
drwx------ 3 user1 user1 4096 08-11 15:40 user1
drwx------ 3 user2 user2 4096 09-18 21:03 user2

[root@localhost ~]# vim /etc/auto.master

9 /misc  /etc/auto.misc
10 /nishome  /etc/auto.qq    --timeout=60

[root@localhost ~]# cp -p /etc/auto.misc /etc/auto.qq

[root@localhost ~]# vim /etc/auto.qq

18 *              -ro,soft,intr          192.168.145.100:/nishome/&

[root@localhost ~]# service autofs restart

Autofs+NFS+NIS实现智能挂载

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/0e25dc5172df8abc94f760647ef194f0.html