Search

User is not in the sudoers file. This incident will be reported

On using the sudo command if we see the error



This means that the user as whom we have logged in and are trying to run the command "sudo" does not have the permission to do so.
Only the users listed in /etc/sudoers have the permission to use the command "sudo".
To give the sudo permission to a user we need to add the user to the file /etc/sudoers file.
Open the file /etc/sudoers as root.



Add the line



under the User privilege specification section.
Save the file and exit, now the sudo command should work for the user which was added in the file.

21 comments:

  1. So you need to run vi as root to be able to run programs as root... interesting.

    ReplyDelete
    Replies
    1. Or as any user with admin privileges so that not every one gets access to complete system.

      Delete
  2. At my system I could access the root account by typing "su root" in the command-line. This will login the root, and works fine for me, but of course "sudo" is much better ;)

    ReplyDelete
    Replies
    1. Well su is also a good option, you don't have to type "su root" . just "su" will also login as root.

      Delete
  3. HAVE THE SAME problem, help, ok, I open sudoers file with usr/sbin/visudo ,or with sudo vi /etc/sudoers, doest matter,I know that I should change root ALL = (ALL) ALL TO username ALL = (ALL) ALL, BUT:
    HOW THE HELL SAVE THIS THING? CTRL + X doesnt work.

    ReplyDelete
    Replies
    1. try sudo -i to login into root then open the sudoers file. It might work.

      Delete
  4. I am getting the same error ,when I write the sudo -i or sudo root,it shows [sudo] password for Dave (My username): and then I see Dave is not in the sudoers file. This incident will be reported.

    I use Oracle Linux

    ReplyDelete
    Replies
    1. Were you able to add your username to sudoers file ?

      Delete
  5. nope. having the same problem as above - very odd... had it and then lost it. root, that is.

    ReplyDelete
  6. WHOA!! Thats dangerous! Use the % and assign yourself to the group using groupadd or gnome-user-management panel..which for gnome3 needs to be installed via aptitude, synaptic, or via apt-get.Reboot to fix.

    ReplyDelete
  7. use su - to open a root console. Yall are doing it wrong.

    ReplyDelete
  8. Richard, what are the proper steps?

    My main account is named "capacitor" and I have a temporary account named "tempuser" that I am trying to assign all privileges to.

    In the end I am trying to change the User ID number so that it is the same number as my mac user files (501) and I can seemingly only change the ID of capacitor if I am logged in as someone else, in this case "tempuser"

    ReplyDelete
  9. Linux Mint 14 x64:
    su -

    chmod u+rw /etc/sudoers
    vi /etc/sudoers
    add ALL = (ALL) ALL
    :x
    chmod u-w /etc/sudoers

    Voila!

    ReplyDelete
  10. Thanks Anonymous! That worked for me.

    ReplyDelete
  11. Hey Read this Link hope it will help as it works for me :)
    http://www.broexperts.com/2013/03/username-is-not-in-the-sudoeur-name/

    ReplyDelete
    Replies
    1. I do not see any difference in what is there in that link an this one. post......

      Delete
  12. I think use the following command is better and safe

    switch to root and then command:

    usermod -a -G wheel someusername

    ReplyDelete
    Replies
    1. haven't tried that, but should work . Thanks for the info :-)

      Delete