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.

2 Answers 2


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.

  • Is this implemented on all currently supported Ubuntus or only a certain version and later? (Because that's relevant, if only 'cause it's tagged 12.04)
    – Thomas Ward
    Jun 26, 2015 at 2:13
  • I don't have a 12.04 system around to check, but AFAIK, Polkit came along before 12.04. For example, see this question from 2011: askubuntu.com/q/78352/158442.
    – muru
    Jun 26, 2015 at 2:17
  • I am not sure how to configure the pkexec eg. for hibernating , see askubuntu.com/questions/641238/…. A related discussion is chat.stackexchange.com/rooms/25226/… .Thanks! Jun 26, 2015 at 11:58
  • Unfortunately with pkexec I don't see command output in the terminal.
    – gmk57
    Dec 20, 2021 at 17:34

To go from a nonprivileged user to a sudo user, you do not use sudo.

Instead, you first have to switch users.

Login as the other user with the following command from nosudo user (assuming nosudo is the nonprivileged user, yessudo is the sudoer):

su - yessudo

It will then prompt for the login password for yessudo. After you login as yessudo you can run sudo commands from that user. If at any time you exit out of that and return to the nosudo user, you have to do the command above again.

  • Note that this does not solve the problem of you not being in sudoers. Also consider that it's probably that way for a reason, so you should reconsider the ramifications of going about this method.
    – Thomas Ward
    Jun 26, 2015 at 2:09
  • 1
    @ Thomas W.: Yes, I care for security and I will always switch back to the 'nosudo' user. I understand that the system cannot switch it back straight automatically . Jun 26, 2015 at 2:51
  • @ Thomas W.: Is it not possible to enable using sudo from the standard user by adding somehow the standard user into a sudoers file? Thanks! Jun 26, 2015 at 3:16
  • @TomasPeceny yes, but at that point the user becomes a privileged user, and not a standard user. Add the unprivileged user to the sudo group, and they'll have sudo access (usermod -a -G sudo nosudo is the command, where nosudo is the non-sudoers user from above). Then, nosudo user should log out and log back in, thereby refreshing their groups membership. (HOWEVER, while this would do what you achieve and give sudo access to the nosudo user, pkexec would be a better option if you want to keep nosudo as an unprivileged user)
    – Thomas Ward
    Jun 26, 2015 at 3:23
  • @ Thomas W.: I see I have misunderstood the term 'sudoer'. I seek for a method how to shorten the time when I am connected to the network as the privileged user. As far as possible without complicated configuring. Your answer appears to be really the proper solution for me. Thanks! Jun 26, 2015 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.