linux nfs4 超时,Linux文件服务器NFS详解【4】

#没有权限解决

[[email protected] data]# touch aa01.txt

touch: cannot touch `aa01.txt’: Permissiondenied

[[email protected] share]# ls -l /share/ -d

drwxr-xr-x. 5 root root 4096 Aug 12 21:45/share/

[[email protected] share]# chmod 777 /share

[[email protected] share]# ls -l /share/ -d

drwxrwxrwx. 5 root root 4096 Aug 12 21:45/share/

[[email protected] data]# touch aa01.txt

[[email protected] data]# ll aa01.txt

-rw-r--r-。 1 4294967294 4294967294 0 Aug 1221:50 aa01.txt

#mount过去后不再是root用户

[[email protected] share]# ll aa01.txtconfig-2.6.32-131.0.15.el6.x86_64

-rw-r--r--。 1 nfsnobody nfsnobody 0 Aug 12 21:50 aa01.txt

-rw-r--r-。 1 root root 100182 Aug 12 21:45 config-2.6.32-131.0.15.el6.x86_64

#普通用户默认不切换身份

#添加用户

[[email protected] data]# useradd zhink

#切换到普通用户

[[email protected] data]# su - zhink

#创建文件

[[email protected] data]$ touch aa02.txt

[[email protected] data]$ ll aa02.txt

-rw-rw-r-。 1 4294967294 4294967294 0 Aug 1221:57 aa02.txt

#共享目录里查看文件权限

[[email protected] share]# useradd zhink

[[email protected] share]# ll aa02.txt

-rw-rw-r-。 1 zhink zhink 0 Aug 12 21:57aa02.txt

#serv02删除用户,发现用户变成编号了

[[email protected] share]# userdel zhink -rf

[[email protected] share]# ll aa02.txt

-rw-rw-r-。 1 500 500 0 Aug 12 21:57 aa02.txt

#添加新用户,发现文件的拥有者和组又变成新添加的用户,也就是没法区分

[[email protected] share]# useradd larry

[[email protected] share]# ll aa02.txt

-rw-rw-r-。 1 larry larry 0 Aug 12 21:57aa02.txt

[[email protected] data]# touch aa03.txt

Password:

[[email protected] ~]# userdel -rf zhink

[[email protected] share]# ll aa03.txt

-rw-r--r-。 1 nfsnobody nfsnobody 0 Aug 1222:00 aa03.txt

#root用户不转换

[[email protected] share]# vim /etc/exports

[[email protected] share]# cat /etc/exports

/share *(rw,no_root_squash)

[[email protected] share]# /etc/init.d/nfs restart

Shutting down NFS mountd: [ OK ]

Shutting down NFS daemon: [ OK ]

Shutting down NFS services: [ OK ]

Starting NFS services: [ OK ]

Starting NFS daemon: [ OK ]

Starting NFS mountd: [ OK ]

#重新挂载

[[email protected] data]# umount /data

[[email protected] data]# mount 192.168.1.11:/share/data

#创建文件

[[email protected] data]# touch aa04.txt

#查看文件属性,发现变化成root用户

[[email protected] share]# ll aa04.txt

-rw-r--r--。 1 root root 0 Aug 12 22:03 aa04.txt

#查看帮助文件

[[email protected] share]# man exports

#远程接口调用,NFS借助此服务

[[email protected] share]# /etc/init.d/rpcbindrestart

#映射成其他用户

[[email protected] share]# id linux

uid=501(linux) gid=501(linux)groups=501(linux)

[[email protected] share]# vim /etc/exports

[[email protected] share]# cat /etc/exports

/share*(rw,all_squash,anonuid=501,anongid=501)

[[email protected] share]# /etc/init.d/nfs restart

Shutting down NFS mountd: [ OK ]

Shutting down NFS daemon: [ OK ]

Starting NFS services: [ OK ]

Starting NFS daemon: [ OK ]

Starting NFS mountd: [ OK ]

[[email protected] /]# umount /data

[[email protected] /]# mount 192.168.1.11:/share/data

[[email protected] share]# ll aa05.txt

-rw-r--r--。 1 linux linux 0 Aug 12 22:14aa05.txt

[[email protected] data]# useradd larry

[[email protected] data]# su - larry

[[email protected] data]$ touch aa06.txt

[[email protected] share]# ll aa06.txt

-rw-rw-r--。 1 linux linux 0 Aug 12 22:15aa06.txt

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值