nfsnobody用户权限 [英] nfsnobody User Privileges

查看:147
本文介绍了nfsnobody用户权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在两台CentOS 6、64台机器之间设置了NFS文件共享.在服务器上,要共享的文件夹最初是由root用户拥有的.在客户端上,它显示为nfsnobody所拥有.当我尝试从客户端写入文件夹时,出现权限错误.因此,我将服务器上的文件夹所有权更改为nfsnobody,并将其chmod更改为777.但是,仍然没有喜悦-我继续遇到权限错误.显然,这还有更多.我将不得不使用任何能够帮助解决此问题的Linux专家(我个人不应该被称为新手).

编辑-我应该已经提到,尝试从客户端写入共享文件夹实际上可以创建一个文件条目.但是,文件大小为0,并且报告了权限错误.

解决方案

此处的问题与/etc/exports 中的条目有关.它应该显示为

 文件夹ip(rw,** all_squash **,sync,no_subtree_check) 

我错过了all_squash位.此外,请确保服务器上的文件夹由nfsnobody拥有.在我的设置中,我的客户端和服务器nfsnobodies最终都以用户ID(如果为65534)结尾.但是,非常值得检查此(/etc/groups)否则....

这里有一些有用的参考资料

如何设置NFS服务器 CentOS上的NFS

为了给任何想要设置NFS服务器的人带来好处,我在下面提供了在我的CentOS 6 64位计算机上可以使用的功能.

  SERVERyum安装nfs-utils nfs-utils-lib-安装NFSrpm -q nfs-utils-检查安装/etc/init.d/rpcbind开始chkconfig --levels 235 nfs on/etc/init.d/nfs开始chkconfig-级别35 rpcbind 

完成此操作后,您应该创建要共享的文件夹

  mkdir文件夹chown 65534:65534文件夹chmod 755文件夹 

现在定义要共享/导出的文件夹.使用您喜欢的文本编辑器(vi或其他)来打开/创建/etc/exports

 文件夹clientIP(rw,all_squash,sync,no_subtree_check)客户如上安装,检查,绑定和启动mount -t nfs serverIP:文件夹clientFolderLocation 

如果一切顺利,您现在应该可以在客户端上编写一个小脚本

 <?php$ file = $ _SERVER ['DOCUMENT_ROOT']."/../nfsfolder/test.txt";file_put_contents($ file,'NFS的世界你好!');?> 

浏览它,发现服务器上现在存在test.txt,内容为"NFS的Hello world".在该示例中,我已将安装的驱动器放在document_root之前的一级.

I have setup an NFS file share between two CentOS 6, 64 machines. On the server the folder being shared was originally owned by the root user. On the client it turned up as being owned by nfsnobody. When I tried to write to the folder from the client I got a permissions error. So I changed the folder ownership on the server to nfsnobody and chmod'd it to 777. However, still no joy - I continue to get a permissions error. Clearly, there is more to this. I would be much obliged to any Linux gurus out there (I personally wouldn't merit being called anything more than a newbie) who might be able to help fix this issue.

Edit - I should have mentioned that trying to write to the shared folder from the client actually manages to create a file entry. However, the file size is 0 and the permissions error is reported.

解决方案

The issue here is to do with the entry in /etc/exports. It should read

folder ip(rw,**all_squash**,sync,no_subtree_check)

I had missed the all_squash bit. That apart, make sure that the folder on the server is owned by nfsnobody. On my setup both my client and server nfsnobodies ended up with a user id if 65534. However, it is well worth checking this (/etc/groups) or else... .

Here are a couple of useful references

How to setup an NFS SErver NFS on CentOS

For the benefit of anyone looking to setup an NFS server I give below what worked for me on my CentOS 6 64bit machines.

SERVER
yum install nfs-utils nfs-utils-lib  - install NFS
rpm -q nfs-utils - check the install

/etc/init.d/rpcbind start
chkconfig --levels 235 nfs on
/etc/init.d/nfs start
chkconfig --level 35 rpcbind on

With this done you should create the folder you want to share

mkdir folder
chown 65534:65534 folder
chmod 755 folder

Now define the folder to be shared/exported. Use your favorite text editor (vi or whatever) to open/create /etc/exports

 folder clientIP (rw,all_squash,sync,no_subtree_check)

 Client
 Install, check, bind and start as above
 mount -t nfs serverIP:folder clientFolderLocation

If all goes well you should now be able to write a little script on your client

<?php
$file = $_SERVER['DOCUMENT_ROOT']."/../nfsfolder/test.txt";
file_put_contents($file,'Hello world of NFS!');
?>

browse to it and find that test.txt now exists on the server with the content "Hello world of NFS". In the example I have placed my mounted drive one level before document_root.

这篇关于nfsnobody用户权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆