Home Linux How to Fix Username is not in the sudoers file. This incident...

How to Fix Username is not in the sudoers file. This incident will be reported

0

How to Fix Username is not in the sudoers file. This incident will be reported.

ROOT user account is the super user account, is able to modify system settings. but sometime wrong command execution itself damage root user account. And leave you somewhere you cannot move from there.

Users only get access to root only by using the sudo command as by default root user account is locked in Ubuntu.
When after executing wrong command and you loose privilege of accessing sudo.. that is referred as broken sudo.

See the image – 1 showing the error as Username is not in the sudoers file. This incident will be reported.

How to Fix Username is not in the sudoers file. This incident will be reported
Image – 1
How to fix this broken sudo in Ubuntu.
Switch on the machine and keep tapping shift key to get the Grub boot menu. Select Advanced options for Ubuntu using the drop down arrow and press enter to get in to it as per image – 2.


Image – 2
Select the kernel with Recovery mode and press enter to get in to it. as per image – 3.


Image – 3
Once you there in the Recovery Menu page. using drop down select root and press enter to get in to the terminal for maintenance as per image – 4


Image – 4
Now here you have got root prompt but its read-only, to remount it as read write, lets execute below command.

$ mount -o rw,remount /

Now as the error says username is not in the sudoers file. lets now add user name in /etc/sudoers file.
$ nano /etc/sudoers then add the user name as per Image – 5
username ALL=(ALL:ALL) ALL


Image – 5
Now save and Exit from the nano editor and reboot the system.
$ shutdown -r now
Now you can run sudo without any issues.

You may also like: How to resolve network wifi issue in Ubuntu 16.04 LTS


NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exit mobile version