Error solving: Linux OS "Username is not in the sudoers file. This incident will be reported."

In the Linux Operating System"Username' is not in the sudoers file. This incident will be reported"



Sometimes, an error can be resolved without fixing it, especially if the system administrator intentionally restricts access as a security measure, causing the problem. In such cases, the administrator's defined permissions must be utilized, as mentioned above in the Figure.

Method 01: Adding the Username to the Sudoers File

Our main goal here is to add the user directly to the sudoers file. So we need to switch to the root user, since "student" can’t perform any administrative tasks:



Once we’ve made the switch, we’ll edit the sudoers file using nano/vim. This is a text editor that allows us to edit files from the command line:


Let’s add a line under the user privilege specification. Its purpose is to grant the system user the mentioned superuser privileges:








Now "student " can perform tasks that require root access.

Shortly after making the change, we need to save these changes and exit from the text editor. To do this, we’ll press the keyboard keys CTRL+X to exit, Y to save, and Enter to submit. Finally, we can exit from the root session.

Method 02: Adding the User to the Administrator Group

The "usermod" command allows us to modify our user’s attributes. In particular, we use the 
-G option to declare that we’d like to update the group information for our user student. Also, the -a option makes certain that other groups associated with this user aren’t deleted in the process. As a result, student can now perform administrative tasks with sudo. 





Click for Practical session: -


Google Translate Integration

Comments