Linux adds sudo permissions to the user: Sometimes, running the sudo command under Linux will prompt similar: Xxxis not in the sudoers file. This incident would be reported. Here, XXX is the user name and then causes the sudo command to be unable to execute, at this time, the following resolves:
- Enter Super User mode. That is, enter "Su-", the system will let you enter the super user password, enter the password and enter the Super User mode. (Of course, you can also use root directly)
- Add Write permission to the file. That is, enter the command "chmod u+w/etc/sudoers".
- Edit the/etc/sudoers file. That is, enter the command "vim/etc/sudoers", enter the edit mode, find this line: "root all= (All)all" in the following add "xxx all= (All)all" ( Here's xxx is your username) and then save the exit.
- Revoke write permissions for the file. This is the input command "chmod u-w/etc/sudoers". And then it's okay.
(Linux switch User: SU user name)
04. Add sudo permissions to Linux users