请教NFS的权限问题

15 views
Skip to first unread message

Eric

unread,
May 21, 2010, 1:29:36 AM5/21/10
to lzuossteam
我在一台电脑上共享了一个文件夹,然后在另外一台电脑上挂载的时候总出现读写权限的问题。
 
我的系统:RHEL AS4.8
server上的配置:
   /etc/exports文件
       /home/TEST1  *(rw)      #(TEST1的所有者和所有组都是root)
       /home/server/TEST2 *(rw)  #(TEST2的所有者和所有组都是普通用户server)
 
在客户端挂载的时候,挂载点都是在普通用户目录下,比如/home/client/point,
point的所有者和所有组都是普通用户client。
把/home/TEST1挂载过来后point的属性变成了 755 root root,
如果把/home/server/TEST2挂载过来,point的属性变成 755 501 501,同样没有写的权限。
 
为什么都没有写的权限呢?难道用NFS挂载过来后就只能读吗?那么写了(rw)还有什么用呢,还是我没有设置好呢?
 
另外请教一下除了NFS还有没有其他可以比较容易实现文件共享的办法??
2010-05-21

Eric

--
您收到此邮件是因为您订阅了 Google 网上论坛的“lzuossteam”论坛。
要向此网上论坛发帖,请发送电子邮件至 lzuos...@googlegroups.com
要取消订阅此网上论坛,请发送电子邮件至 lzuossteam+...@googlegroups.com
若有更多问题,请通过 http://groups.google.com/group/lzuossteam?hl=zh-CN 访问此网上论坛。

kang kang

unread,
May 21, 2010, 2:31:11 AM5/21/10
to lzuos...@googlegroups.com
看 man page:

User ID Mapping

nfsd bases its access control to files on the server machine on the uid and gid provided in each NFS RPC request. The normal behavior a user would expect is that she can access her files on the server just as she would on a normal file system. This requires that the same uids and gids are used on the client and the server machine. This is not always true, nor is it always desirable.
Very often, it is not desirable that the root user on a client machine is also treated as root when accessing files on the NFS server. To this end, uid 0 is normally mapped to a different id: the so-called anonymous or nobody uid. This mode of operation (called 'root squashing') is the default, and can be turned off with no_root_squash.

By default, exportfs chooses a uid and gid of 65534 for squashed access. These values can also be overridden by the anonuid and anongid options. Finally, you can map all user requests to the anonymous uid by specifying the all_squash option.

Here's the complete list of mapping options:

root_squash
Map requests from uid/gid 0 to the anonymous uid/gid. Note that this does not apply to any other uids that might be equally sensitive, such as user bin.
no_root_squash
Turn off root squashing. This option is mainly useful for diskless clients.
all_squash
Map all uids and gids to the anonymous user. Useful for NFS-exported public FTP directories, news spool directories, etc. The opposite option is no_all_squash, which is the default setting.
anonuid and anongid
These options explicitly set the uid and gid of the anonymous account. This option is primarily useful for PC/NFS clients, where you might want all requests appear to be from one user. As an example, consider the export entry for /home/joe in the example section below, which maps all requests to uid 150 (which is supposedly that of user joe).

2010/5/21 Eric <zhang...@gmail.com>

Eric

unread,
May 21, 2010, 4:46:20 AM5/21/10
to lzuossteam
我看到这一句:This requires that the same uids and gids are used on the client and the server machine.
然后我在server和client上用同样的id做实验,结果OK,可以读写。
 
但我还是有疑问,如果客户端的uid和gid不能跟服务器上的id匹配(比如客户端的uid和gid已经被占用),难道就只能只读了吗?有什么解决办法吗?
 
2010-05-21

Eric

发件人: kang kang <kangka...@gmail.com>
发送时间: 2010-05-21 14:31
主 题: Re: 请教NFS的权限问题

胡洪兵

unread,
May 21, 2010, 12:07:58 PM5/21/10
to lzuos...@googlegroups.com
你试试 no_root_squash 这个参数吧!
Reply all
Reply to author
Forward
0 new messages