I am doing a fresh install of a minimal Ubuntu system with MATE desktop environment. When I click on NetworkManager's icon and then a wireless network to connect to, I receive a dialog box that says:
Connection failure
Failed to add/activate connection
(32) Insufficient privileges.
I am doing a clean reinstallation of Ubuntu 14.04 with Lubuntu 14.04.1 alternate installer and choose F4 -> "Install a basic command-line system", then install X, MATE and NetworkManager manually like this:
sudo apt-get install software-properties-common -y
sudo apt-add-repository ppa:ubuntu-mate-dev/ppa -y
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate -y
sudo apt-get install xorg mate-core --no-install-recommends -y
sudo apt-get install network-manager network-manager-gnome --no-install-recommends -y
If that helps, when I install Ubuntu that way, it asks for password upon attaching and unmounting a USB flash drive. Also, when I am creating a shortcut for shutdown
command, to be able to shut down my computer with a click on an icon, I have to alter permissions for /sbin/shutdown
:
chmod u+s /sbin/shutdown
Maybe something similar is going on with Wi-Fi and I need to alter some permissions for it to work properly?
Step 1
This can be cured by fixing PolicyKit rule for the NetworkManager. First of all check whether
.pkla
file with[nm-applet]
section already exists in/etc/polkit-1/localauthority/10-vendor.d
. If yes, make a backup of it and alterResultAny=no
value toyes
in[nm-applet]
section of this file.The structure of these policy rule files is described here.
If this file is absent in
10-vendor.d
folder, we will create PolicyKit rule manually. Create the file with the nameorg.freedesktop.NetworkManager.pkla
containing the next lines:Replace your_username in this file with your real login name. If you wish to add several users, change the
Identity
entry like this (and replace usernames with the desired ones):If you wish to add even more users, then you should consider adding all of them to
netdev
group withuseradd
and change the rule to:Now copy this
.pkla
file to the PolicyKit directory:Step 2
You should also check whether PolicyKit Authentication Agent is running - this rule won't work without it. If
ps -ef | grep kit | grep agent
returns nothing, then it isn't running.Check whether this binary exists. For GNOME this file can be found here:
For MATE it is located here (for 32-bit and 64-bit respectively):
Its location may vary in different DE. If it was not found there, seek for it:
If you found nothing, then PolicyKit Agent isn't installed at all. Search for the package name in APT database with
apt-cache search PolicyKit Authentication Agent
command and install appropriate package for your DE. For MATE it will bemate-polkit
.It doesn't start automatically for some reason. You can search
/etc/xdg/autostart
for the PolKit Agent.desktop
launcher and analyze why it fails to start. Or you can create your own launcher using "Startup Applications" of your DE and add the Polkit Authentication Agent command to start it properly.If you are interested, there's an extensive and nice article about PolicyKit privileges.
@whtyger answer works perfectly on Ubuntu 16.04. I don't know what MATE is but I was trying to run bash/python script via
php exec
. (long story, trying to run these commands from php.) Ubuntu wasn't allowing me to control the network setting from the terminal. Followed these instructions and now I'm really happy! Hope this helps!