4

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.

muru
  • 207,228
Tomáš Pečený
  • 1,507
  • 7
  • 19
  • 46

2 Answers2

5

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
Password:

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.

muru
  • 207,228
4

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.

Thomas Ward
  • 78,878