CentOS7.9 executes the sudo command and prompts "XXX is not in the sudoers file"

Reason

The default user of CentOS does not have sudo permission, so the sudo command cannot be used

Solution

Add the user to the sudoers file

Switch to the root user, entervi /etc/sudoers

Add at the end of the file <username> ALL=(ALL) ALL, if you want to use the command without entering a password sudo, add <username> ALL=(ALL) NOPASSWD: ALL, <username> is your own username

 Use wq!强制the command to save the file and exit the editor

Guess you like

Origin blog.csdn.net/weixin_55988897/article/details/128709858