1. Switch to the root user
2. Add the sudo file write permissions
Execute the command: chmod + U w / etc / sudoers
3. Edit the sudoers file
Execute the command: vi / etc / sudoers
Find the line root ALL = (ALL) ALL
Add this line below xxx ALL = (ALL) ALL (xxx is your user name)
Note: You can add any of the following four lines line:
youuser ALL = (ALL) ALL
% youuser ALL = (ALL) ALL
youuser ALL = ( ALL) the NOPASSWD: ALL
% youuser ALL = (ALL) the NOPASSWD: ALL
The first line: allows the user to execute youuser sudo command (password required).
The second line: allows the user to perform user group youuser inside sudo command (password required).
Third row: sudo command allows the user to execute youuser (no password).
Fourth row: which allows the user to group youuser sudo command performed by the user (no password).
4. revocation of write access to the file sudoers
Execute the command: chmod uw / etc / sudoers