使用root用户修改系统配置,让普通用户能启停服务:
[root@localhost ~]# vi /usr/share/polkit-1/actions/org.freedesktop.systemd1.policy
<action id="org.freedesktop.systemd1.manage-units">
<description>Manage system services or units</description>
...................
<!--
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
-->
把org.freedesktop.systemd1.manage-units节点下,defaults下的auth_admin修改为yes
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
重起polkit之后普通用户即可执行systemctl start/stop xxx服务了
[root@localhost ~]# systemctl restart polkit
例如:普通用户 执行 systemctl stop keepalived 不用输入密码了
原文链接:https://blog.csdn.net/ohaozy/article/details/106355222
标签:status,centos,stop,auth,start,systemctl,yes,普通用户,root From: https://www.cnblogs.com/xiedy001/p/16878898.html