没有用户/组与NIS / NFS

软件概述

机器A (NIS服务器):CentOS 6.2

机器B 🙁 NFS服务器)CentoS 6.2

客户端机器: OpenSuse 12.3,CentOS 6.4和CentOS 5.6

介绍和设置

机器A是服务于一组客户端机器的NIS服务器。 在NIS映射中定义的主目录来自NFS服务器(机器B )在login时自动挂载。

机器B是使用NIS进行身份validation的NFS服务器。

当我login到客户端机器时,我可以读/写我的主目录,其中的所有文件都是

alex users 

在许可方面。 login到NFS服务器时也是如此。

但是,当我login到NIS服务器,我的主目录挂载,我可以写入文件,但所有文件显示为

 nobody nobody 

许可。 尽pipe这whoami yeilds alex

testing:在/ home / alex目录中的NIS服务器上创build文件

如果我在login到NIS服务器时在主目录中创build一个文件

 touch /home/alex/testfile ls -l testfile # on server -rw-r--r--. 1 nobody nobody 0 Mar 19 14:21 testfile 

但如果我在客户机上运行ls -l

 ls -l testfile # on client machine -rw-r--r--. 1 alex users 0 Mar 19 14:21 testfile 

很明显,正在创build文件,因为在NIS服务器上正在考虑正确的用户和权限。 除了nobody nobody显示我的文件nobody nobody一切显示正常,但我担心这可能是更严重的事情的症状。

testing: ypcat命令

login到NIS服务器时,我可以运行

 ypcat passwd 

并获得输出。

不过ypcat shadow收益率

  No such map shadow. Reason: Internal NIS error 

但我会认为这是因为我有

 MERGE_PASSWD=true 

设置在我的/var/yp/Makefile

不必要的密码冗余

作为最后一个奇怪的转折 – 对于一些用户来说,他们能够通过NIS使用旧密码login,这些旧密码不应该再起作用。 我不知道这是怎么发生的,因为/ etc / passwd和/ etc / shadow中每个用户只有一个条目? 这可能是一个不相关的问题,或者可能提供有用的信息。

我想你正在客户端机器上安装nfsv3,在机器B上安装nfsv4(nis服务器)

如果您使用autofs来挂载主目录,请在机器B上添加-nfsvers = 3选项

古斯塔沃的回答基本上是正确的,但我想我会添加一些细节,而不是作为一个评论

我作为nsf4无处不在,但由于某种原因nsf4不能在NIS服务器上工作。

defaultvers=3,nfsvers=3到auto.master的安装行中,然后是服务,这样我的auto.master文件看起来像这样

 # # Sample auto.master file # This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location # For details of the format look at autofs(5). # /misc /etc/auto.misc # # NOTE: mounts done from a hosts map will be mounted with the # "nosuid" and "nodev" options unless the "suid" and "dev" # options are explicitly given. # /net -hosts # # Include central master map if it can be found using # nsswitch sources. # # Note that if there are entries for /net or /misc (as # above) in the included master map any keys that are the # same will not be seen as the first read key seen takes # precedence. # +auto.master /home yp:auto.home -rw,hard,bg,rsize=32768,wsize=32768,defaultvers=3,nfsvers=3 

紧接着一个autofs重启

 service autofs restart 

有东西起来和运行。

一个随机问题 – 我在物理上login到数据中心的机器,但没有注销,所以即使在重新启动后,pipe理员用户/home目录也没有被重新装入,这造成了一些混淆。