You are not logged in.
I need a VPN connection activation and deactivation privilege for an unprivileged user. So I read about sudoers file on a wiki and with visudo did this:
kinia ALL=(ALL) NOPASSWD:/usr/bin/systemctl stop openvpn-client@SP52-client.serviceSo, user kinia should be able to run this systemctl stop command without being asked for a password.
sudo -lU kinia
User kinia may run the following commands on linux:
(ALL) NOPASSWD: /usr/bin/systemctl stop openvpn-client@SP52-client.serviceHowever, this rule is ignored in favor of:
/usr/share/polkit-1/actions/org.freedesktop.systemd1.policy
<action id="org.freedesktop.systemd1.manage-units">
<description gettext-domain="systemd">Manage system services or other units</description>
<message gettext-domain="systemd">Authentication is required to manage system services or other units.</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>So, the system instead of executing my action, displays a window asking for a password of user in (I guess) adm group.
Before I reconfigure the system to use polkit for this task instead of sudoers file, please tell me why this happens? Is this "works as designed" or I'm doing something wrong here?
Last edited by mkkot (2018-09-23 22:39:43)
Offline
Offline
Yeah, no. I just noticed this silly mistake and wanted to remove this topic, but you already answered.
Anyway, I can see it still asks for a password, this time sudo asks for it:
sudo stop openvpn-client@SP52-client.service
[sudo] password for kinia:Offline
Surely you should be running...
sudo systemctl stop openvpn-client@SP52-client.serviceOffline
Surely I should not be sitting till late night here as my mind seems to be off. Thanks a lot, it works all fine now!
Offline
Yeah, polkit and sudo are two completely unrelated ways of acquiring root permissions for a process... it just happens that by convention, the same users have permission for both, and sometimes, programs like systemctl can be used with either one. ![]()
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline