NFS的实验报告vim
一.实验拓扑:服务器
服务器 ---------- 客户机异步
二.实验条件:async
服务器的ip:192.168.4.5/24ide
客户机的ip:192.168.4.200spa
要肯定机器有安装nfs包跟RPC软件包。rest
三.实验要求:递归
将/root 共享给192.168.4.200 可写,同步,容许客户机以root权限访问ip
NFS 服务端操做:ci
修改配置:
[root@localhost ~]# vim /etc/exports //修改配置的地址
[root@localhost ~]# cat /etc/exports
/root 192.168.4.200(rw,sync,no_root_squash) //配置文件的格式,括号里面是权限)
权限的选择:rw、ro:可读可写、只读
sync、async : 同步写、异步写入
no_root_squash:保留来自客户端的root权限
all_squash :客户端权限都降为nfsnobody
[root@localhost ~]# service portmap restart //重启RPC机制
[root@localhost ~]# service nfs restart //重启nfs服务
[root@localhost ~]# chkconfig nfs on //重启配置
验证并挂载:
[root@localhost ~]# service portmap restart //重启RPC机制
[root@localhost ~]# service nfs restart //重启nfs服务
[root@localhost ~]# chkconfig nfs on //重启配置
[root@localhost ~]# showmount -e 192.168.4.5 //查看共享的内容
Export list for 192.168.4.5:
/root 192.168.4.200
[root@localhost ~]# mkdir -p /data/root //先建立建立文件目录 加 –p 递归的意思 及若是没有上个文件则建立一个
[root@localhost ~]# mount 192.168.4.5:/root /data/root //挂载到该文件夹
[root@localhost ~]# df -hT /data/root/ //查询挂载是否成功
文件系统 类型 容量 已用可用已用% 挂载点
192.168.4.5:/root
nfs 19G 7.3G 11G 41% /data/root
[root@localhost root]# touch root.txt //建立文件夹
[root@localhost root]# ls -l root.txt //查看权限是否属于root
-rw-r--r-- 1 root root 0 06-15 12:23 root.txt
四.实验总结:
实验规律如上,客户机的访问权限在nfs配置文件时括号里的选项。若是中止nfs共享时要把文件卸载了,否则在挂载别的文件时会报错。