问题描述
在执行sudo命令时,出现了“xx is not in the sudoers file. This incident will be reported.”的报错。
解决方法
1、输入命令“su root”。
![在这里插入图片描述](https://img-blog.csdnimg.cn/c67c0b7efe7d4b0aaf8f285e31b940a0.png)
2、输入命令“visudo”。
![在这里插入图片描述](https://img-blog.csdnimg.cn/f9d17239dec74e57839fec62fabdc684.png)
3、进入编译器后在“ root ALL=(ALL:ALL)ALL”下面添加“XX ALL=(ALL:ALL)ALL”。XX为你的用户名,比如我的用户名为:sunrise。
![在这里插入图片描述](https://img-blog.csdnimg.cn/c77227e7dea447878d07af161dd83cfb.png)
4、按“ESC”键,然后输入“:wq”,按“enter”键退出编译器。
![在这里插入图片描述](https://img-blog.csdnimg.cn/8dc22193f48349a08869b4ceb1eadaf5.png)
完成以上步骤后再次使用sudo命令即可成功运行。