4

I want to add a user account to sudoers.

I type in

sudo usermod -aG sudo username

Then I reboot.

I type

apt update

I get permission denied.

I type

sudo apt update

Followed by account password and apt update runs.

I thought that adding things to sudoers allows me to run without specifying sudo and entering password?

pa4080
  • 29,831
  • Correct. However where in your question did you add "things to sudoers"? See for instance https://askubuntu.com/questions/7477/how-can-i-add-a-new-user-as-sudoer-using-the-command-line on enabling a users to be able to issue ANY command. – Rinzwind Aug 22 '18 at 14:46
  • Okay to it does not add "things to sudoers". So

    sudo usermod -aG sudo username

    Does not give sudo privileges to username?

    – rob18767 Aug 22 '18 at 14:56
  • What you did is add a user to the group "sudo" enabling that user to use "sudo". That does not remove the need to use "sudo" before a command nor for you to supply a password every 15 minutes ;) – Rinzwind Aug 22 '18 at 14:57
  • Ah gotcha I ran

    sudo visudo

    And added the line

    username = ALL= (root) NOPASSWD: ALL

    That got me where I wanted. Thank you.

    I will change the last ALL to point to what I want to specifically run in BIN. Thank you.

    – rob18767 Aug 22 '18 at 15:04
  • Adding a user to the /etc/sudoers/ file is not enough... You will have to add the NOPASSWORD tags... – NerdOfCode Aug 22 '18 at 20:32

1 Answers1

3

Adding a user to /etc/sudoers/ just permits this user to invoke commands with sudo. Using sudo is still required.

guntbert
  • 13,134