nfsnobody 用户权限 [英] nfsnobody User Privileges

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

问题描述

我已经在两台 CentOS 6、64 机器之间设置了 NFS 文件共享.在服务器上,共享的文件夹最初归根用户所有.在客户端上,它显示为 nfsnobody 拥有.当我尝试从客户端写入文件夹时,出现权限错误.所以我将服务器上的文件夹所有权更改为 nfsnobody 并将其更改为 777.但是,仍然没有乐趣 - 我继续收到权限错误.显然,还有更多.我非常感谢任何能够帮助解决这个问题的 Linux 大师(我个人不值得被称为新手).

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

解决方案

这里的问题是与/etc/exports中的条目有关.它应该是

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

我错过了 all_squash 位.除此之外,请确保服务器上的文件夹归 nfsnobody 所有.在我的设置中,如果 65534,我的客户端和服务器 nfsnobodies 最终都以用户 ID 结束.但是,非常值得检查这个(/etc/groups)或其他....

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

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

为了任何想要设置 NFS 服务器的人的利益,我在下面给出了在我的 CentOS 6 64 位机器上对我有用的方法.

服务器yum install nfs-utils nfs-utils-lib - 安装 NFSrpm -q nfs-utils - 检查安装/etc/init.d/rpcbind 启动chkconfig --levels 235 nfs on/etc/init.d/nfs 启动chkconfig --level 35 rpcbind on

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

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

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

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

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

浏览它并发现 test.txt 现在存在于服务器上,内容为Hello world of NFS".在示例中,我将安装的驱动器放置在 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天全站免登陆