If you're in the admin
group (or the sudo
group starting with Ubuntu 12.04) but that group isn't configured in /etc/sudoers
to be able to run commands as root with sudo
, you can fix that problem the same way you'd fix a broken sudoers
file:
pkexec visudo
Then just edit the sudoers
file to add whatever entries you need. In particular:
Ubuntu systems before 12.04, or those that were upgraded from a version before 12.04, should have this:
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
Ubuntu 12.04 and later should have this (even if they also have the above lines because they were upgraded from an earlier release):
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
This pkexec
method works (on desktop systems) because Ubuntu systems with a GUI installed have two separate mechanisms for administrators to perform actions as root
: sudo
, and PolicyKit.
See this question about a different but similar problem, if you're curious and want more information:
sudo
. Here, entries may actually be missing. So I think an optimal answer here must also explain how to add the usual entries to allow administrators to use sudo. I've attempted such an answer. I do not recommend that this question be made a duplicate of that one, because unlike with a "little" syntax error, answers there don't clarify how to edit.