2

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.

4

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.

3

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 '15 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 . – Tomáš Pečený Jun 26 '15 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! – Tomáš Pečený Jun 26 '15 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 '15 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! – Tomáš Pečený Jun 26 '15 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.