[RedHat] "is not in the sudoers file" Solution

When executing sudo command in a terminal, the system prompts "luckchengis not in the sudoers file":

$ sudo ls
Password:
luckcheng is not in the sudoers file. This incident will be reported.

In fact, not have permission to sudo, the solution is as follows (assuming the user name here is luckcheng):

1 . Switch to root: $ SU
2
. Open / etc / sudoers file: $ VI / etc / the sudoers . 3 change the contents: Found "the root ALL = (ALL) ALL" line in the following insert a new row, the content of is "luckcheng ALL = (ALL) ALL", and then type the command vi "wq!" to save and exit.

Note: The "!" This file is read-only, save without fail.

4 Exit superuser:. $ Exit
 5 . Can enjoy the use of sudo.

Guess you like

Origin www.cnblogs.com/niuben/p/11226657.html