每当试图以普通用户的身份停止/启动守护程序时,我都会遇到一个奇怪的问题,它会要求使用另一个常规用户的凭据进行身份validation – 例如:
[bob@server ~]$ systemctl stop some-daemon.service ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to manage system services or units. Authenticating as: alice Password:
为什么要求alice在boblogin时进行身份validation,以及如何解决这个问题?
您的系统正在使用polkit授权pipe理器,消息来自文件/usr/share/polkit-1/actions/org.freedesktop.systemd1.policy 。 可以在/etc/polkit-1和/usr/share/polkit-1目录中configurationrules.d ,更具体地说,在rules.d和actions子目录中。 有关更多信息,请参阅Polkit手册页 。
在pipe理系统服务时,您需要以root身份执行,而不是像普通用户那样执行。 这在shell提示符末尾用$字符表示。
您可以使用sudo command或切换到根(通常由#char指示的根shell)。
检查/ etc / groups和sudoers规则。 如果一个人把自己join轮组并成为根,那么就会发生这种情况。