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

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


This article explains how to fix sudo not working on Linux, resulting in this message when trying to use it: "username is not in the sudoers file. This incident will be reported." on Debian (and Debian-based Linux distributions like Ubuntu) or any linux OS. sudo allows system admins to execute commands as root (administrator) or another user.

In Unix/Linux systems, the root user account is the super user account, and it can therefore be used to do anything and everything achievable on the system.

Besides security concerns, access to root privilege is necessary when it’s required to perform system maintenance. The sudo command does exactly that. It grants a command/script root privilege as long as it is executed. Users having access to the sudo command are managed by the sudoers file.

However, this can be very dangerous in so many ways, one could be that the root user might enter a wrong command and breaks the whole system or an attacker gets access to root user account and takes control of the whole system and who knows what he/she can possibly do.

In order to perform crucial tasks on your system such as viewing or altering important system files, or updating the system, you need the sudo command to gain super user privileges.

THE ERROR

Below is an image showing a case in which the default system user is being prevented from running sudo command:

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


FIXING THE ERROR

This is a very common error for the beginners. The error occurs because we are trying to access/update something with super privileges from the user instead of root -user.

Hence, to solve this, we need to make changes in the sudoers file where the root user has been given the privileges. So, switch to root user, run the following command below.

Step 1: Open Terminal.


Step 2: Let’s try the first command and Enter root password.

==>>    sudo su 


Step 3: To give the sudo permission to a user we need to add the user to the file /etc/sudoers file.

==>>   nano /etc/sudoers


Step 4: The editor would open the section of /etc/sudoers file.


Step 5: Now scroll down to the bottom where you will see this line.

==>>   root    ALL=(ALL:ALL)     ALL 


Step 6: Add the same line but replace the username with your username, in my case my username is softxos.

==>>     username     ALL=(ALL:ALL)     ALL


Step 7: After that Press  CTRL 


Step 8: Press 


Step 9: Hit Enter to Save the file.


Step 10: Exit and switch back to the user and start using sudo commands with ease.

==>>     exit 


In some cases, you may need to reboot your operating system to work properly.

As you can see, try running a sudo command as the user and the issue is resolved.


That's all, I hope this helps.

VIDEO TUTORIAL - INSTALLATION GUIDE


DOWNLOAD FILES

Click on below button to start Download the files from the download links.


No-File-Required


We hope you enjoy my Website content as much as we enjoy offering them to you. If you have any questions or comments, please don't hesitate to let comment below.


DISCLAIMER

All videos on my Website and YouTube channel are for Educational purpose only to help people Fix errors and download and install software... for free. Anyone using these videos for any illegal or unlawful purpose will be solely responsible for his/her activity.


0 Comments: