没有 NIS/NFS 的用户/组

没有 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 服务器(计算机) 在登录时自动安装。

机器是一个使用 NIS 进行身份验证的 NFS 服务器。

当我登录到客户端计算机时,我可以读取/写入我的主目录,并且其中的所有文件都是

alex users

在权限方面。当我登录NFS服务器时也是如此。

然而当我登录到 NIS 服务器时,我的主目录挂载了,我可以向其中写入文件,但所有文件都显示为

nobody nobody

获得许可。尽管这whoami会产生alex

测试:在 NIS 服务器上的 /home/alex 目录中创建文件

如果我登录 NIS 服务器后在主目录中创建一个文件

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

因此,很明显,文件是以正确的用户身份创建的,并且 NIS 服务器上的权限也得到了尊重。除了显示我的文件之外,nobody nobody一切似乎都很好,但我担心这可能是更严重问题的征兆。

测试:ypcat命令

登录到 NIS 服务器后,我可以运行

ypcat passwd

并得到输出。

然而ypcat shadow收益

 No such map shadow. Reason: Internal NIS error

但我本以为这是因为我有

MERGE_PASSWD=true

设置在我的/var/yp/Makefile

不必要的密码冗余

最后一个奇怪的转折是一些用户,他们能够使用旧密码通过 NIS 登录,但旧密码不再有效。我不知道这是怎么发生的,因为 /etc/passwd 和 /etc/shadow 中每个用户只有一个条目?这可能是一个不相关的问题,也可能提供有用的信息。

答案1

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

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

答案2

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

我到处都安装有 nsf4,但由于某种原因,nsf4 无法在 NIS 服务器上运行。

在 auto.master 中添加defaultvers=3,nfsvers=3mountline,然后添加服务,这样我的 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

一切恢复正常运转。

一个随机问题 - 我物理登录到我们数据中心的机器但并未注销,因此/home即使重新启动后管理员用户目录也无法重新挂载,这造成了一些混乱。

相关内容