When sudo is used, the system prompts "xxxis not in the sudoers file. this incident will be report ". XXX is your user name. this error indicates that your user name does not have permission to use sudo. We only need to modify the/etc/sudoers file.
The procedure is as follows:
Step 1: Use the Su-command to enter the super Mode
Jibo @ Linux $ su-
Root @ Linux $
Note:
Note that-This is different from Su. When the "Su" command is used, the system only switches to root, but does not pass the root environment variable to the current user, use the "Su-" command to bring the environment variables together, just like root logon.
Step 2: add the write permission to the sudoers file
Root @ Linux $ chmod U + w/etc/sudoers
Step 3: edit the/etc/sudoers file. Find this line: "rootall = (all) All" add "hostname all = (all) All" under the change line (Change hostname to your username), save and exit
Root @ Linux $ gedit/etc/sudoers
In the sudoers fileRoot all = (all) all add
Hostname all = (all) All
Step 4: revoke the write permission of the file.
Root @ Linux $ chmod U-W/etc/sudoers
Switch to the user mode.