Not authorized to control networking in SSH console
I want to control Network manager from the command-line. This worked well enough in Ubuntu 10.04 (with cnetworkmanager, nmcli is another possible choice).
Since the upgrade to Ubuntu 10.10 however, a D-Bus exception is raised when I attempt to activate a connection from within a SSH terminal:
org.freedesktop.NetworkManager.PermissionDenied: Not authorized to control networking.
It may have to do with /etc/dbus-1/system.d/NetworkManager.conf; where else to look for a clue ?
This issue occurs only when I am ssh'd into the machine; in a gnome session I don't get the same issue -- with the same (admin) user account in both cases.
Solution 1:
On more recent Ubuntu's this is control by the polkit.
make new file: /etc/polkit-1/localauthority/50-local.d/allow-ssh-networking.pkla
Add:
[Let adm group modify system settings for network]
Identity=unix-group:adm
Action=org.freedesktop.NetworkManager.network-control
ResultAny=yes
Then restart the polkit
service. (Make sure your user is in the adm group)
You can find a list of valid NetworkManager actions on your system with pkaction | grep NetworkManager
More info: https://forums.fedoraforum.org/showthread.php?276493-Remotely-starting-a-VPN-connection-does-not-work
Solution 2:
By default, DBus only allows root
and users sitting at the physical console to control networking settings.
This can be changed by editing DBus policy files, in this case /etc/dbus-1/system.d/NetworkManager.conf