赞
踩
客户端挂载nfs共享目录时的报错信息:mount.nfs: access denied by server while mounting 192.168.41.191:/nfsfile
NFS服务器
1、我原来nfs配置文件exports里面的内容如下
[root@master ~]# vim /etc/exports
/nfsfile 192.168.41.*(rw,sync,root_squash)
2、重启rpcbind和nfs-server服务;查看了一下nfs-server服务,上面显示“Active: active (exited) ",意思是“活动:活动(已退出)”,这是正常现像,没有影响的,跟后面客户端挂载时的报错是没有关系的。
[root@master ~]# systemctl restart rpcbind [root@master ~]# systemctl restart nfs-server [root@master ~]# systemctl status nfs-server ● nfs-server.service - NFS server and services Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled) Active: active (exited) since Sat 2022-03-12 05:27:14 CST; 2s ago Process: 9334 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS) Process: 9333 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS) Process: 9330 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS) Process: 9345 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS) Process: 9343 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Main PID: 9345 (code=exited, status=0/SUCCESS) CGroup: /system.slice/nfs-server.service Mar 12 05:27:14 master systemd[1]: Starting NFS server and services... Mar 12 05:27:14 master systemd[1]: Started NFS server and services.
NFS客户端
1、使用showmount命令查询NFS服务器的远程共享信息
[root@node1 ~]# showmount -e 192.168.41.191
Export list for 192.168.41.191:
/nfsfile 192.168.41.*
2、创建本地挂载目录(如已创建有,请忽略)
[root@node1 ~]# mkdir /nfsfile
3、使用mount命令挂载nfs服务器共享目录,发现出现了报错,挂载不上(报错意思大概就是服务器拒绝访问)
[root@node1 ~]# mount -t nfs 192.168.41.191:/nfsfile /nfsfile
mount.nfs: access denied by server while mounting 192.168.41.191:/nfsfile
[root@node1 ~]#
回到NFS服务器查错,看看是什么问题
1、修改配置文件exports
就是把共享目标权限改为*(所有,全部)
[root@master ~]# vim /etc/exports
vim /etc/exports
/nfsfile *(rw,sync,root_squash)
2.重启服务
[root@master ~]# systemctl restart rpcbind
[root@master ~]# systemctl restart nfs-server
NFS客户端
1、使用mount命令重新挂载,回车后没有返回报错信息,即是成功挂载上,可用df -h查看挂载情况
[root@node1 ~]# mount -t nfs 192.168.41.191:/nfsfile /nfsfile
[root@node1 ~]#
2、使用df -h命令查看nfs挂载情况,可以看到nfs共享目录
[root@node1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 18G 1.1G 17G 6% /
devtmpfs 903M 0 903M 0% /dev
tmpfs 913M 0 913M 0% /dev/shm
tmpfs 913M 8.6M 904M 1% /run
tmpfs 913M 0 913M 0% /sys/fs/cgroup
/dev/sda1 497M 125M 373M 25% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/sr0 4.1G 4.1G 0 100% /opt/centos
//192.168.41.191/user1 18G 1.1G 17G 6% /mnt
192.168.41.191:/nfsfile 18G 1.1G 17G 6% /nfsfile
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。