How to Use Sudo from a Standard User on Ubuntu 12.04


If I try using sudo as a non-privileged user, I get a message that the user is not in the sudoers file. I know the Administrator password, but I do not know, how to use it from a non-privileged (Standard) user.

Best Answer

Use pkexec instead. If the current user doesn't have privileges, or if there are multiple users who can authorize an action, it will prompt you to select the user:

$ pkexec true              
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/true' as the super user
Multiple identities can be used for authentication:
 1.  muru
 2.  sysad, (sysad)
Choose identity to authenticate as (1-2): 1

pkexec, of course, does not follow the sudo configuration, but its own. However, if you added admin users by adding them to the sudo group, they will also be granted Polkit admin rights by Ubuntu's default configuration.