centos搭建NFS服务常见错误
思韵闪耀
2023-11-02
0

在NFS客户端执行:showmount -e

报这个错误:

clnt_create: RPC: Program not registered 

解决方法

网上大部分都是重启nfs和rpcbind的服务

systemctl restart nfs-utils
systemctl restart rpcbind

操作后并没有正常,后面发现在了一个操作就正常了

systemctl restart rpcbind
systemctl restart nfs-server
systemctl restart nfs-utils

********************************************

mount -t nfs 192.168.16.126:/home/share /home/nfsshare

mount.nfs: Connection refused

解决方案:重启nfs和rpcbind的服务

systemctl restart rpcbind
systemctl restart nfs-server
systemctl restart nfs-utils

********************************************

systemctl stop rpcbind.service

Warning: Stopping rpcbind.service, but it can still be activated by: rpcbind.socket

在此同时查看rpcbind.sock仍然处于活动状态

netstat -anlp | grep -i rpc
unix 2 [ ACC ] STREAM LISTENING 19174 1/systemd /var/run/rpcbind.sock

经过一段时间观察后,发现rpcbind.套接字再次激活 rpcbind 服务。

解决方案

如果希望暂时停止 rpcbind 服务而不被 rpcbind. socket 稍后激活,请先停止 rpcbind.service,然后停止 rpcbind.套接:

systemctl stop rpcbind.service
systemctl stop rpcbind.socket

********************************************

mount -o nolock -t nfs 192.168.16.126:/home/share /home/nfsshare

mount.nfs: access denied by server while mounting 192.168.16.126:/home/share

vi /etc/exports

在里面加入

/home/share 192.168.16.0/24(rw,all_squash)

********************************************

svc: failed to register lockdv1 RPC service (errno 111).

解决方案:

nfs mount 默认选项包括文件锁,依赖于portmap提供的动态端口分配功能。

解决方法:kill 文件锁(lockd)或者mount -o nolock

********************************************

挂载时使用了RW权限挂载,当时读写仍然Permission denied

重启NFS服务以后,在客户机通过

mount -o nolock 192.168.16.126:/home/share /home/nfsshare

命令将网络文件mount到本地。执行完成之后,目录是可以访问了,但无法写入。感觉有点奇怪,明明在命令中指定可以写入了。

于是到网上搜索资料,发现exports目录权限中,有这么一个参数no_root_squash。

其作用是:登入 NFS 主机使用分享目录的使用者,如果是 root 的话,那么对于这个分享的目录来说,他就具有root 的权限!。

默认情况使用的是相反参数root_squash

在登入 NFS 主机使用分享之目录的使用者如果是 root 时,那么这个使用者的权限将被压缩成为匿名使用者,通常他的 UID 与 GID 都会变成 nobody 那个身份。

因为我的客户端是使用root登录的,自然权限被压缩为nobody了,难怪无法写入。将配置信息改为:

/home/share 192.168.16.0/24(rw,no_root_squash)

据说有点不安全,但问题是解决了。

【版权声明】
本站部分内容来源于互联网,本站不拥有所有权,不承担相关法律责任。如果发现本站有侵权的内容,欢迎发送邮件至masing@13sy.com 举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

相关内容

centos stream...
1、更新系统软件包确保系统已经更新到最新版本,打开终端,执行以下命...
2024-03-30
linux(centos7...
linux(centos7)firewalld-cmd查看防火墙状...
2024-03-15
centos7 firew...
1. firewalld1.1 firewalld守护进程fire...
2024-03-15
Centos系统firew...
端口放行限制1)放开UDP 161/162端口firewall-c...
2024-03-02
centos7 firew...
名词解释 在具体介绍zone之前学生先给大家介绍几个相关的名词,因...
2023-12-22
CentOS Stream...
操作系统:CentOS Stream 9 无界面最小化安装SSH工...
2023-12-22

热门资讯

SIOCADDRT: Netw... SIOCADDRT: Network is unreachable SIOCADDRT: 网络不可达...
centos7下创建新用户和组 linux下添加,删除,修改,查看用户和用户组 1 .增加一个test组 groupadd test...
linux通过sed 修改文件... 13sy.txt里面内容如下 A; B; C; write by luohao199621; 1.要...
关于cannot remove... 关于cannot remove directory: Directory not empty的解决办...
mount: unknown ... mount: unknown filesystem type LVM2_member解决方案 系统启...
OpenMediaVault安... OpenMediaVault 是一个基于Debian的专用 Linux 发行版,用于构建网络连接存储...
centos7 双网卡双网关的... 最近公司需要在一台服务器上同时使用内网和外网,并且都需要跨网段访问,因此需要双网关,但是一台机子上只...
ethtool 命令详解 1 概述 ethtool 是用于查询及设置网卡参数的命令。 2 命令详解 2.1 命令格式 (1) ...
CentOS7单网卡设置双IP... linux系统CentOS7单网卡设置双IP的方法,centos7.5、7.6、7.7设置双IP教程...
Linux进程状态D,S,Z的... Linux进程状态top,ps中看到进程状态D,S,Z的含义 在top和ps命令中有一列显示进程状态...