0

I have created a "normal" user with sudo privileges, lets say newuser. I created with the GUI Users and Groups and created as administrator. If i want to install a new program or whatever needs root permissions i have to do sudo and then put the root password. Ex: sudo apt install geany

I have tried to edit the visudo file giving to the user the same permissions as root user. I followed : https://www.liquidweb.com/kb/add-user-grant-root-privileges-ubuntu-18-04/

newuser ALL=(ALL:ALL)ALL

But still i cant execute apt update or apt upgrade or whatever without sudo. Thats make no sense. Ubuntu should not ask for root password as the newuser has the same privilegees as root.

Im missing something ?

Thanks in advance

4
  • Is there something in this reference which helps? maketecheasier.com/how-to-manage-user-ubuntu/…
    – graham
    Oct 2, 2020 at 8:50
  • 2
    To clarify: sudo does not ask for the root password, it asks for your password. It asks you to prove that it is really you, the sudo user, not just someone who happens to find an open terminal session. Only su root would ask for the root password.
    – Jos
    Oct 2, 2020 at 9:37
  • 1
    You can run sudo -i and thus "switch" to root. This way you will have the # prompt and you will be able to enter your privileged commands without sudo. Note that using the root prompt (#) extensively is very dangerous and you should return to normal ($) prompt ASAP by entering exit or Ctrl+D at command prompt.
    – FedKad
    Oct 2, 2020 at 13:36
  • i was wrong. I thought a normal user with root permissions could run apt upgrade or apt install without sudo. Also i thought that when you execute sudo apt upgrade, and then ask for password, the password was the root one. @Jos commented that only is asking for your password to assure that is really me who im executing that order.. which makes more sense. I Oct 3, 2020 at 9:37

2 Answers 2

0

No normal user has "the same privileges as root". Having the same privileges as root means running processes with EUID (effective UID) equal to 0, and no user except root has UID of 0. That's exactly what sudo is for - switching from running with EUID equal to your regular user UID to running with EUID=0. That's something that is called "privilege elevation". Ubuntu does not support direct login as root (you can configure it that way so you can login as root, but many programs will simply refuse to run as root), so if you want to run anything with root privileges, you have to use sudo (or equivalent, like pkexec for GUI programs).

0

In order to run apt update or any command requiring superuser privileges, you need to run

sudo <program name>

If what you want is being able to execute such commands without entering the password, you have to edit the sudoers file (using visudo) adding the following directive:

newuser ALL=(ALL) NOPASSWD: ALL

In case you want to allow an entire group to execute sudo without asking for the password, you add (notice the % before the group name):

%yourgroup ALL=(ALL) NOPASSWD: ALL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .