How can I set the permissions for users to make changes to the network connections and state? For instance, how can I allow/disallow users to connect to new wireless networks? How can I allow/disallow users to turn off networking?
Ubuntu – How to set the policy for users to modify the network state and connections
network-managerpolicykit
Best Answer
You can create a local policy for one or more users.
Create the document where the settings will live...
Add one or more policies...
The key is the
ResultActive
element which can be set to yes, no, auth_admin, or auth_admin_keep where the latter two will require the password of another user with sudo privileges.The
Action
element defines what action will be allowed/disallowed or require authentication with a password. There are options likeorg.freedesktop.NetworkManager.enable-disable-network
for toggling network as enabled/disabled. You can see more options in the/usr/share/polkit-1/actions/org.freedesktop.NetworkManager.policy
file, just look for something like<action id="org.freedesktop.NetworkManager.enable-disable-network">
and read it's description.You can also set all values with the
*
wildcard...This will require a password to make ANY change to network settings or state.
You can do this in a single command that could be included in a script...
References: