You can edit system configuration files, but that's brute force. First of all, as a rule of thumb, configuration resides under /etc
, not /usr
or /var
or anywhere else. HarlemSquirrel explained how to do a proper change to the default policy. Editing files under /usr
is guaranteed to blow up in your face sooner or later, as those files are provided by system packages, which will be updated/replaced eventually.
But the bigger problem is that these changes are completely unnecessary, as of 18.04 at least. This is a "you're holding it wrong" issue. Actually, it's a usability issue on the NM applet's part, but anyway. Take a look at /usr/share/polkit-1/actions/org.freedesktop.NetworkManager.policy
:
<action id="org.freedesktop.NetworkManager.settings.modify.system">
<description>Modify network connections for all users</description>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
Meaning users can't create connections, right? Wrong! Look further:
<action id="org.freedesktop.NetworkManager.settings.modify.own">
<description>Modify personal network connections</description>
<defaults>
<allow_any>auth_self_keep</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
As you can see, NetworkManager supports the concept of user and system connections. The problem is, the applet creates system connections by default. So when you open the applet on the tray and click Select Network, then select the one you want to connect to, it asks for a sudo user, because creating system connections are only allowed for admins.
BUT if you open the Settings app, go to Wi-Fi and click on the desired network, it'll easily let you connect without admin password. Walk in the park.
Why the applet wants to create system connections by default is beyond me though, especially since you can make a user connection a system one anytime later. It's the Make available to other users option under connection properties, and when you check that and click Apply, it'll immediately ask for sudo password, as it should. I'll try to find a way to make the applet create user connections by default, I'll update this answer if I figured it out.
/etc/sudoers
is the file to edit so it does not ask for passwords: https://help.ubuntu.com/community/Sudoers – Rinzwind Jan 18 '13 at 09:30visudo
before to allow the non-admin user to do a few things (likesudo apt-get upate
for e.g.) but I am not sure what I would have to put in there to stop them being asked for a password on connecting to a new wifi network – fpghost Jan 18 '13 at 09:32someUser ALL=(root)NOPASSWD:/path/to/somethingControllingWiFi
I presume, if this is indeed the way to go. – fpghost Jan 18 '13 at 09:36connection available to all
is already ticked. The non-admin user can connect to a pre-established connection without issue (e.g. home wifi say), the problem is when they try to connect to a genuinely new wifi network (say at a cafe or hotel), somewhere never previously connected to, then upon attempting to connect viaNetworkManager
the non-admin user is prompted for my (the admins) password. – fpghost Jan 18 '13 at 10:31Edit Connections
for the pre-established connection msg isSystem policy prevents modifications of network settings for all users: an application is attempting to perform an action that requires privileges. Authentication as the super user is required to perform this action. Password for adminuser: ......
then the Details expansions saysAction: org.freedesktop.NetworkManager.settings.modify.system, Vendor: NetworkManager
if that helps. – fpghost Jan 18 '13 at 10:45available to all
fix has to be applied for every single wifi network, so isn't practical for non-admin users connecting to new wifi on their own. – fpghost Jan 19 '13 at 11:11