Linux users cannot use the sudo command. linux users use the sudo command.
The newly created sudo command cannot be used. The following message is displayed:
Xiaojing is not in the sudoers file. This incident will be reported
It turns out that the newly created user is not in the sudoers management file, so it is not enough to add it to it. The following method is used:
1. Switch to the root user.
Su root # The system will prompt you to enter the password of the root user
2. Add the sudoers file write permission.
Chmod u + w/etc/sudoers
3. Edit the sudoers file and add the corresponding content.
Vim/etc/sudoers
Find
# User privilege specificationroot ALL = (ALL: ALL) ALL
In the following example
Xiaojing ALL = (ALL: ALL) AL # xiaojing is a new user
(Note: In vim, press: I to enter edit mode. Save: Press ESC to Enter command mode, and then enter ": wq" to save and exit)
4. revoke the sudoers file permission.
Chmod u-w/etc/sudoers
Now xiaojing can use the sudo command.