-3

I am trying to add a particular user in the group using command: sudo usermod -a -G groupname username. but getting error as "Username is not in the sudoers file. This incident will be reported".

I dont have any idea about sudoers file. Can anybody please help me on this.

shael
  • 59
  • 2
  • 9
  • There is a file called `/etc/sudoers` in Unix, You cannot achieve modification of user, unless you're(your username) in the sudoers list, with permissions granted to you. – Am_I_Helpful Nov 16 '15 at 13:00
  • 3
    This question is quite [off-topic](http://stackoverflow.com/help/on-topic) for SO. Should be a better fit for [Unix & Linux](http://unix.stackexchange.com/) or [SuperUser](http://superuser.com/). – Oldskool Nov 16 '15 at 13:19
  • This is also trivially [googleable](https://www.google.co.uk/search?q=Username+is+not+in+the+sudoers+file.+This+incident+will+be+reported&oq=Username+is+not+in+the+sudoers+file.+This+incident+will+be+reported&aqs=chrome..69i57j0l4.219j0j7&sourceid=chrome&es_sm=91&ie=UTF-8) which leads you straight to [another stackexchange site](http://askubuntu.com/questions/151200/my-main-username-is-not-in-the-sudoers-file) – Quentin Nov 16 '15 at 13:24

1 Answers1

0

The config file /etc/sudoers lists the users who are allowed to run which commands as which user.

On Ubuntu, this file contains a line allowing all users of the sudo group to run commands as the root user.

To check which users are in the sudo group you can type getent group sudo. You can also check the groups of your current user by typing id.

To allow another user to run sudo, you can add them to the sudo group:

sudo adduser username sudo

Or, if your current user can't run sudo, you will need to boot into "Recovery mode" from Grub (hold shift while booting, if your grub menu doesn't show up automatically), or add single to the linux ... initrd ... quiet splash line, then:

mount -o rw,remount /
adduser username sudo

Run adduser for each user you want to be able to sudo. Then exit & resume.

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
malyy
  • 859
  • 5
  • 10