After a long search on the web, trying everything I can find I came to ask you guys, how can I add an existing user to be a sudoer?
usermod -a -G sudo user
both while in root... the first one didn't work at all and the second one supposedly added 'user' to sudoers but when I try to run sudo with that user it says: user is not in the sudoers file. This incident will be reported.
When I run adduser again, it says the user 'user' is already a member of 'sudo'.
what can I do???
-EDIT: for clarification, I do want the user to be prompted for a password when trying to run sudo. currently when the user is running sudo he is being prompted for a password and then he gets "user is not in sudoers file...." I wand him to be able to run sudo, be prompted and then escalate the privilege.
As root edit /etc/sudoers and place the following line:
youruser ALL=(ALL) NOPASSWD:ALL
# Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL
In this way you will be capable to execute all commands that require sudo privileges passwordless.
In order to use sudo and be prompted for a password you need to remove
/etc/sudoersyou may loose your sudo access at all.- Use
visudoinstead. — Jul 19, 2021 at 08:21