創建共享文件夾:mkdir /nfsshareDir
安裝服務:#sudo apt-get install portmap
#sudo apt-get install nfs-kernel-server
#sudo gedit /etc/exports
在彈出的文本編輯器中編輯exports 文件,在最後一行添加:
/nfsshareDir *(rw,sync,no_root_squash)
no_root_squash:登入 NFS 主機使用分享目錄的使用者,如果是 root 的話,那麼對於這個分享的目錄來說,他就具有 root 的權限!
root_squash:在登入 NFS 主機使用分享之目錄的使用者如果是 root 時,那麼這個使用者的權限將被壓縮成爲匿名使用者
附:
/etc/exports內容如下:
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/nfsshareDir *(rw,sync,no_root_squash)