1、在客户端挂载NFS文件系统出现如下错误:

pi@raspberrypi:/mnt $ sudo mount -t nfs -o nolock,rw,async,wsize=32768,rsize=327                                                                                        68 192.168.2.35:/share /mnt/share
mount.nfs: access denied by server while mounting 192.168.2.35:/share
pi@raspberrypi:/mnt $ sudo mount -t nfs -o nolock,rw,async,wsize=32768,rsize=32768 192.168.2.35:/share /mnt/share
mount.nfs: access denied by server while mounting 192.168.2.35:/share
pi@raspberrypi:/mnt $

2、查看NFS文件系统配置文件访问限制在192.168.1.0网段

root@ubuntu-mate:~# nano /etc/exports
  GNU nano 2.2.6             File: /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_sub$
#
# 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)
#
/share 192.168.1.*(rw,sync,no_root_squash,no_subtree_check)

3、原来服务器IP为1段,后来改为了2段,所以把192.168.1.*替换为192.168.2.*,重新启动NFS服务即可。

root@ubuntu-mate:~# /etc/init.d/nfs-kernel-server restart
[ ok ] Restarting nfs-kernel-server (via systemctl): nfs-kernel-server.service.
root@ubuntu-mate:~#



注意:本文归作者所有,未经作者允许,不得转载