这似乎应该是简单的,但如果是这样,我一定会错过一些东西。 我有一个Linux的NIS主从我想能够改变用户的密码(在忘记密码和类似的事情),但我不能。
一些细节:我正在运行Scientific Linux 6.4,使用ypserv-2.19-26,ypbind-1.20.4-30和yp-tools-2.9-12。 NISconfiguration为使用/etc/yp/passwd
作为passwd映射(即不是系统passwd文件)。 系统本身是一个客户端, ypwhich
返回“localhost”。
因为非特权用户不应该login到NIS主机,所以我们在/etc/nsswitch.conf
设置了以下内容:
passwd: files compat
而这在/etc/passwd
结尾:
+::::::/bin/false
另外,/ /etc/pam.d/passwd
包含标准的RHEL指令:
password substack system-auth
/etc/pam.d/system-auth
是/etc/pam.d/system-auth
的符号链接,其中包含:
password requisite pam_cracklib.so try_first_pass retry=3 type= password sufficient pam_unix.so md5 shadow nis nullok try_first_pass use_authtok password required pam_deny.so
(作为一个方面说明,我们使用的是md5而不是sha512,因为我们有一些不支持sha512的Solaris客户端。)
如果我以root身份运行passwd
,它会提示我input新密码,但是却无法更改它:
$ sudo passwd phil Changing password for user phil. New password: Retype new password: NIS password could not be changed. passwd: Authentication token manipulation error
日志文件( /var/log/secure
)是无用的:
passwd: pam_unix(passwd:chauthtok): password not changed for phil on ypmaster.domain.tld
如果我运行yppasswd
,则可以更改密码:
$ sudo yppasswd phil Changing NIS account information for phil on ypmaster.domain.tld. Please enter root password: Changing NIS password for phil on ypmaster.domain.tld. Please enter new password: Please retype new password: The NIS password has been changed on ypmaster.domain.tld.
但是,这需要任何需要重置密码的系统pipe理员才能知道(或从我们locking的密码安全中查找)系统的root密码,这是我想避免的一种情况。
那么,我该如何configuration主机才能让我们更改用户密码,而不必每次input系统的root密码?
正如您发现的那样,您不能在NIS客户端上以root身份使用passwd
来更改NIS服务器上的用户密码。 这是真正的常识安全。
同样,您已经发现yppasswd需要root密码(在NIS服务器上)才能让您更改用户的密码。 这是一个额外的安全性,因为你应该是NISpipe理员(在NIS服务器上的根目录)来改变其他人的密码。
不幸的是,这一点安全性不是你想要的,所以yppasswd正在阻碍你。
我认为这实际上是一个相对较新的东西,或者是一个特定于操作系统的变种 – 在我定期处理NIS的Sunpipe理date间,如果您是NIS服务器的根,那么您只能信任您。
由于您的要求(让授权的pipe理员对NIS密码进行更改)我build议的是编写一个shell脚本(或者您喜欢的语言),直接编辑NIS映射并重build/推送它们。
你可以用一点创意sed
工作来做到这一点,然后授予你的pipe理员使用sudo
运行脚本的能力。
最终,尽pipe你可能要考虑从NIS中移走( LDAP是替代NIS的新热点 ,几乎是一种替代scheme,而WAY更易于pipe理)。