Linux: How to Solve sudo operate Error

Here, I need to install a driver on the server. When using sudo command, the following error is reported
XXX (user name) is not in the sudoers file. This incident will be reported.
it should be noted that my user is not a super administrator user, but a new ordinary user developed by the super administrator user, The reason why the above error is reported is that this user is an ordinary user and does not have operation permissions on the operating system. Here, the super administrator needs to add top-level permissions to ordinary users in the configuration file sudoers. The operations are as follows:

1. Switch to root, directly enter Su in terminator, and then prompt for the password. The password here is the login password of super administrator

2. The/etc/sudoers file is read-only by default for all users (including the root user), so you need to add write permission to the sudoers file. The command is: CHMOD U + W/etc/sudoers

3. Edit the sudoers file VI/etc/sudoers
the sudoers file is as follows


find this line root all = (all) all, and add XXX all = (all) all (XXX here is your user name)

PS: Here you can add any of the following four lines to sudoers

youuser ALL=(ALL) ALL
%youuser ALL=(ALL) ALL
youuser ALL=(ALL) NOPASSWD: ALL
%youuser ALL=(ALL) NOPASSWD: ALL

Line 1: allow user youuser to execute sudo command (password required).
line 2: allow users in user group youuser to execute sudo command (password required).
line 3: allow user youuser to execute sudo command without entering password.
line 4: allow users in user group youuser to execute sudo command, And do not enter the password when executing

4. Revoke sudoers file write permission. Command:

chmod u-w /etc/sudoers

Read More: