10

When we log into a KDE seesion using X2Go client, the user is greeted with a dialog asking for a sudo password. I do not want the user to have a sudo password and I would like to prevent the dialog from appearing. The user should not be bothered with this.

The dialog title is: Authentication Required PolicyKit1 KDE Agent

The message is:

**System policy prevents control of network connections**  
An application is attempting to perform an action that requires privileges. Authentication is required to perform this action.  
Password:

Action: Allow control of network connections  
ID: org.freedesktop.NetworkManager.network-control  
Vendor: NetworkManager  
polkit.subject-pid: 20440  
polkit.caller-pid: 708  

- process 708 is /usr/bin/NetworkManager --no-daemon
- process 20440 is kded5 [kdeinit5]

pkaction version 0.116  (that's the policykit version)

The related policy is already defined so that authentication should not be requested / required:

<action id="org.freedesktop.NetworkManager.network-control">
<_description>Allow control of network connections</_description>
<_message>System policy prevents control of network connections</_message>
<defaults>
  <allow_inactive>yes</allow_inactive>
  <allow_active>yes</allow_active>
</defaults>
</action>

Relevant log lines are:

Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: "Password: "
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Request:  "Password: "
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: REQUEST
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Trying again

Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Action description has been found
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Message of action:  "System policy prevents control of network connections"
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Initiating authentication
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: polkit_qt_listener_initiate_authentication callback for  0x55df1e7190a0
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: GSimpleAsyncResult: 
Aug 07 21:50:54 desktop polkit-kde-authentication-agent-1[26611]: Listener adapter polkit_qt_listener_initiate_authentication

Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: Authentication agent result: true
Aug 07 21:50:43 desktop polkitd[838]: Registered Authentication Agent for unix-session:19 (system bus name :1.5274 [/usr/lib/polkit-kde-authentication-agent-1], object path /org/kde/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: Listener online
Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: Adding new listener  PolkitQt1::Agent::Listener
Aug 07 21:50:43 desktop polkit-kde-authentication-agent-1[26611]: New PolkitAgentListener

Aug 07 21:50:42 desktop ksmserver[26587]: org.kde.kf5.ksmserver: Starting autostart service  "/etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop" ("/usr/lib/polkit-kde-authentication-agent-1")

What I have tried so far is creating this polkit rule:

/etc/polkit-1/rules.d/00-networkmanager.rules

polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.settings.modify.system")
{
        polkit.log("NetworkManager.settings.modify.system: rule called");
    return polkit.Result.YES;
}
});

polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.network-control")
{
        polkit.log("NetworkManager.network-control: rule called");
    return polkit.Result.YES;
}
});

The rule is owned by root and has 644 permissions.

0

1 Answer 1

6

Try with a pkla (PolicyKit Local Authority) file:

$ sudo ls -la /etc/polkit-1/localauthority/50-local.d
total 16
drwxr-xr-x 2 root root 4096 Dec 28 20:08 .
drwx------ 7 root root 4096 Aug  1  2017 ..
-rw-r--r-- 1 root root  573 Dec 27 01:16 45-allow-colord.pkla
-rw-r--r-- 1 root root  206 Dec 28 20:08 50-allow-network-manager.pkla

$ sudo cat /etc/polkit-1/localauthority/50-local.d/50-allow-network-manager.pkla
[Network Manager all Users]
Identity=unix-user:*
Action=org.freedesktop.NetworkManager.settings.modify.system;org.freedesktop.NetworkManager.network-control
ResultAny=no
ResultInactive=no
ResultActive=yes
5
  • Thank you but that did not resolve it for me. I used the pkla file contents you show and the file has 640 permissions (and it owned by root). Did I miss any steps?
    – MountainX
    Jan 5, 2020 at 3:50
  • I would like to accept your answer. What else is required to get the solution to work?
    – MountainX
    Feb 3, 2020 at 0:48
  • Sorry, I don't know why I doesn't work for you... It worked for me.
    – jsiwrk
    Feb 4, 2020 at 19:01
  • It also just worked for me, thank you @jsiwrk! Jun 2, 2020 at 19:33
  • @MountainX you should create the file 50-allow-network-manager.pkla Sep 27, 2020 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.