Redhat System:
The Create user command in Linux is: Useradd user name, Eg:useradd test
Specify password: passwd test
But sometimes we need to run a command with test to execute some root user, and there are two ways: the first, the method is executed with the test user and executed by the root user. Second, use the sudo command to give the user test a root permission temporarily. The first one we don't think about, the second is our main adoption method, but by default, the user does not have sudo permissions, this needs to be given by the root user. If nothing is done, the Execute sudo command will cause an exception: "Test is not in the sudoers file." The matter will be reported. "。
Log in to the system using the root user and view the file/etc/sudoers permissions information as shown below:
We can see that the permissions for this file at this time are the root user and the supper user group have Read permissions, other users do not have permissions. At this point, modify the file permissions for the root user to write, execute the command chmod u+w/etc/sudoers or execute chmod 640/etc/sudoers.
Modify the contents of the file: Vim/etc/sudoers, modify as follows:
The original
After adding the
Restore file permissions, command chmod u-w/etc/sudoers or execute chmod 440/etc/sudoers.
At this point, complete ... If not, then reboot.
[Linux]-xxx is not in the sudoers file. The matter will be reported.