企业需求:
配置nfs服务器,将/common目录共享给dn.ws.com域,并允许客户端以root用户访问时,也拥有root用户权限。
实施步骤:
1.检查nfs服务。保证正常。
[root@dtop30 ~]# rpm -qa |grep nfs

已经安装了。如果没有安装,即安装之。
[root@dtop30 ~]# chkconfig nfs on
[root@dtop30 ~]# service nfs start
2.创建目录/common,所有人可读、写、执行。
[root@dtop30 ~]# mkdir /common
[root@dtop30 ~]# chmod 777 /common
3.编辑/etc/exports,这个文件最初是空的。
[root@dtop30 ~]# vim /etc/exports
/common *.dn.ws.com(rw,sync) 注意()是紧挨着的,没有空格
[root@dtop30 ~]# service nfs restart
[root@dtop30 ~]# showmount -e localhost


4.挂载测试:
[root@dtop30 ~]# mount -t nfs 172.24.30.30:/common/ /mnt
[root@dtop30 ~]# mkdir /mnt/nfs.txt
[root@dtop30 ~]# ls -l /mnt/

5.以root用户访问时,也拥有root用户权限。
[root@dtop30 ~]# umount /mnt
[root@dtop30 ~]# vim /etc/exports
/common *.dn.ws.com(rw,no_root_squash,sync) 注意:这里加上了“no_root_squash”
[root@dtop30 ~]# service nfs reload
[root@dtop30 ~]# exportfs -v

6.重新挂载测试:
[root@dtop30 ~]# mount -t nfs 172.24.30.30:/common/ /mnt/
[root@dtop30 ~]# mkdir /mnt/
[root@dtop30 ~]# ls -l /mnt/nfs_root
