2
user@main-desktop:~$ sudo apt-get python-cheetah
[sudo] password for user: 
user is not in the sudoers file.  This incident will be reported.

So that is what I get when trying to install something while logged into my user account. It's prompting me for the user password.

How do I get it to prompt me for my admin account's password so that it will allow me to install something? I want to try and keep the user account seperate. I'm new to linux but it seems like adding a user account to the sudoers file defeats the purpose of having a user account.

  • So just to be clear - you have actually two users, one was created during install and has admin priviledges and the other is this one which does not have admin priviledges? If so, this works as designed, you cannot install software for the whole system witohut admin priviledges. Actually, just go with the use created during install, sudo is meant to only run processes that need root priviledges (so that you do not run firefox as root) with root priviledges and this is exactly its point - to have one user account and being able to admin the system without loggin as root. – sup May 6 '15 at 12:06
  • There is a second case. Maybe you removed yourself from sudo group like this guy: maketecheasier.com/fixing-sudo-error-in-ubuntu – Cikson May 6 '15 at 12:13
  • possible duplicate of How do I add myself back as a sudo user? – s3lph May 6 '15 at 12:25
  • Yes, this is the case. But I figured there would be a way to use admin credentials while on another user account (like you can with windows). That way you only provide the credentials during task needed, otherwise you stay in user mode. – dcvl May 6 '15 at 15:43
  • Separation of duties (regular user and system administration) while is exactly, what sudo is made for. You may want to read help.ubuntu.com/community/RootSudo. – David Foerster May 7 '15 at 20:21
1
  • For individual commands to run as super-user, use:

    sudo -u your-admin-account sudo COMMAND [ARGS...]
    

    (replace your-admin-account with the name of your admin account)

  • To start a shell as your-admin-account use:

    su - your-admin-account
    

    In this shell you can use sudo with your admin account's password. When you don't need the admin shell any more close it using exit or Ctrl+D.

  • This was the fix! Thank you. I was under the impression sudo was all I needed to make the superuser perform the action. The su allowed me to move into the admin account and then sudo apt-get the install I needed. Thanks! – dcvl May 6 '15 at 15:45
  • Similarly, for individual commands use sudo -u your-admin-account sudo COMMAND [ARGS...]. This would be more in the spirit of the normal use of sudo as a user in /etc/sudoers. – David Foerster May 7 '15 at 20:29
0

Use pkexec instead. pkexec prompts with a list of users who can authorize the action, if the current one can't:

user1@ica:~$ DISPLAY= pkexec bash
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/bash' as the super user
Authenticating as: Muru (muru)
Password: 

I unset DISPLAY to show you the CLI prompt, but pkexec typically uses a graphical prompt if the GUI is available.

0

The user that you are trying to install from named user has no sudo power which means he is not an admin on your system.

In order to install a package you should be a sudoer which means admin user.

So you can fix your problem by either use a sudoer user to install or change your account from normal user to admin user.

To change this account to sudo user you have to run this command using either root user or another sudo user

sudo usermod -a -G sudo user

sudo usermod -a -G sudo adm

But according to @muru advice not to use usermod -a -G this is another way to perform the same task

sudo adduser user sudo

sudo adduser user adm

Now the user named user is a sudoer

  • 1
    The adm group typically grants access to some logs. The wheel group in older installation grants access to sudo. In either case, use adduser instead of useradd. – muru May 6 '15 at 12:12
  • I do know what adm group is for. askubuntu.com/questions/612751/… – Maythux May 6 '15 at 13:14
  • Hooray! Then why haven't you explained the difference in the post, instead simply adding users to various groups? – muru May 6 '15 at 13:16
  • for useradd or adduser it still a mysterious for me lol askubuntu.com/questions/611954/when-to-use-adduser-or-useradd – Maythux May 6 '15 at 13:16
  • 1
    The user actually doesn't need to perform anything. "I want to try and keep the user account seperate." – muru May 6 '15 at 13:18

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.