5

User is in the sudo group

/etc/sudoers file does have an entry

%sudo ALL=(ALL:ALL) ALL

But they still get the message:

user not in sudoers file. This incident will be reported.

1
  • 1
    Have the user type the groups command and see (show in the Question) if it contains “sudo”. Perhaps they logged in before being added to the group.
    – Jeff Schaller
    Commented Jan 19, 2018 at 22:47

2 Answers 2

5

If you've just added the user to the sudo group, you need a fresh login into the OS. So you may log out and then log back again. Or you can use another tty to do the sudo task without logging in. (Try Ctrl+Alt+F1...F8.)

If you only guess the user is in the group, while in fact it is not, you need to run these two commands:

su root 

And now as root:

adduser user_name sudo

And now relog or log into another tty.

2
  • Thanks, this solved my "problem", which drove me nuts. <3
    – jhoepken
    Commented Nov 14, 2019 at 8:29
  • user147505: "And now relog or log into another tty !"
    – Oli
    Commented Jul 6, 2020 at 13:03
3
sudo -l

should show you the commands you may and may not execute. You can add another -l for longer output, and specify a user with -U:

$ sudo -ll -U myuser
Matching Defaults entries for myuser on myserver:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty

User myuser may run the following commands on myserver:

Sudoers entry:
    RunAsUsers: ALL
    RunAsGroups: ALL
    Commands:
    ALL

You must log in to answer this question.

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