How To Fix USER is not in the sudoers file. This incident will be reported.

Share it:

In this tutorial, I will show you how to fix "USER is not in the sudoers file. This incident will be reported." on Redhat 7 / Centos 7

In Linux OS root is the Super user and having all rights to achieve anything either good or bad.

It is locked by default for the normal users and you will get the error "users is not in sudoers file" if you try to switch as root

How to fix USER is not in the sudoers file?

Step 1: Login as root
su (or) su -
Step 2: Edit the visudo file

Type visudo in terminal and search for the below line

root ALL=(ALL) ALL

Step 3: Add your username to the sudoers file
username ALL=(ALL) ALL

- adminpc is my username

Step 4: Save and exit the file and try to switch as root

Share it:

Post A Comment: