1.服務端配置
vi /etc/exports
/hello 192.168.10.2(ro)
service portmap start
service nfs start
showmount -e //查看服務器本機的共享內容
mkdir /hello
touch /hello/test.txt //測試
2.客戶端配置
service portmap start
showmount -e 192.168.10.1 //查看192.168.10.1服務器的共享內容
moun -t nfs -o soft 192.168.10.1:/hello /mnt //將服務器的/hello目錄掛載到本機的/mnt目錄上
3.在客戶機上訪問
vi /mnt/test.txt //由於在服務器上設定的是隻讀ro,所以這裏只能查看
如果想要在客戶端編輯需修改服務器的/etc/exports
vi /etc/exports
/hello 192.168.10.2(rw)
chmod 757 /hello/test.txt //修改文件權限
exportfs -rv //重新mount使配置生效