Linux NFS文件共享
发布于 2019-09-04 · 本文总共 1237 字 · 阅读大约需要
4 分钟
NFS
NFS Server安装
Ubuntu
sudo apt-get update
sudo apt-get install -y nfs-kernel-server
cd /home/qiuwenqi
mkdir nfs
sudo vi /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)
#
/home/qiuwenqi/nfs *(rw,sync,no_root_squash,no_subtree_check)
重启服务:
sudo /etc/init.d/rpcbind restart
sudo /etc/init.d/nfs-kernel-server restart
NFS Client
showmount -e 10.160.50.1
Exports list on 10.160.50.1:
/home/qiuwenqi/nfs *
挂载:
sudo mount -t nfs 10.160.50.1:/home/qiuwenqi/nfs /Users/rainmc/hytera/NFS
报错:mount_nfs: can’t mount /home/qiuwenqi/nfs from 10.160.50.1 onto /Users/rainmc/hytera/NFS: Operation not permitted mount: /Users/rainmc/hytera/NFS failed with 1
解决:
simply adding -o resvport to the mount_nfs command resolves the above command line error and successfully mounts the NFS share.
sudo mount_nfs -o resvport 10.160.50.1:/home/qiuwenqi/nfs /Users/rainmc/hytera/NFS
refs
https://thornelabs.net/posts/operation-not-permitted-mounting-nfs-share-on-os-x-mountain-lion.html
https://www.cyberciti.biz/faq/apple-mac-osx-nfs-mount-command-tutorial/