Problem: xxx is not in the sudoers file.This incident will be reported.
because the average user can not use sudo.
Solving steps:
1, switch to the root user:
su root
2, add sudo write access to the file, the command is:
chmod u+w /etc/sudoers
3, edit sudoers file:
vi /etc/sudoers
Find the line root ALL=(ALL) ALL
, add it below xxx ALL=(ALL) ALL
(here xxx
is your user name)
Under here to say, you can sudoers
add any of the following four lines a:
youuser ALL=(ALL) ALL
%youuser ALL=(ALL) ALL
youuser ALL=(ALL) NOPASSWD: ALL
%youuser ALL=(ALL) NOPASSWD: ALL
The first line: allows the user to youuser
execute sudo command (password required).
The second line: allows the user to set youuser
inside sudo command performed by the user (password required).
Third row: Allows users to youuser
execute sudo command, and do not enter the password in the course of implementation.
Fourth row: Allows the user group youuser
which sudo command performed by the user, and do not enter a password at the time of execution.
4, revoke
sudoers
file write permissions, the command:chmod u-w /etc/sudoers
So far, the average user can use sudo.