# Solution for the Error “*** is not in the sudoers file. This incident will be reported. “

On the Raspbian system, when I created a new user with the commands
#useradd gang
There is no directory named "gang" under the home directory. When I login as a user (gang) and want to use the sudo command to create a main directory for myself, I saw the error "gang is not in the sudoers file. This incident will be reported. " This error implies that I have to edit the sudoers file to give myself the privilege to use sudo. To have the root privilege, I need to do as follows.

(1) Login as root

(2) Add the privilege of writing for users
#chmod u+w /etc/sudoers

(3) Open the file /etc/sudoers,
#vi /etc/sudoers
and, find the line

root ALL=(ALL:ALL) ALL

Then, add the following lines (jack and gang are examples of the uers' name):

gang ALL=(ALL)ALL
jack ALL=(ALL)ALL

(4) Cancel the privilege of writing for users
# chmod u-w /etc/sudoers

(5)Now as a ordinary user (gang), I can use sudo. For example, to create a new directory under /home/:
\$sudo mkdir gang

[微信] 扫描二维码打赏

[支付宝] 扫描二维码打赏