How to fix “Username is not in the sudoers file. This incident will be reported.” error

Abu Eesa
FusionQA
Published in
Dec 20, 2018

I recently made a new user called ‘jenkins’ on Ubuntu.

And I tried to switch to a user by sudo su — ubuntu and it gave me the error:

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

To fix this issue we just need to add the jenkins user to the sudoers file.

First get back to the user that has the proper permissions, in my case it was switching back to the user ubuntu, by typing exit until I was where I started.

Then I executed this to add my new jenkins user added to the sudoers file:

echo 'jenkins ALL=(ALL) ALL' >> /etc/sudoers

Now the jenkins has been added to the sudoers file and will be able to switch users and perform other tasks.

--

--