Username is not in the sudoers file. This incident will be reported

最近在研究openwrt的编译.

因为openwrt的编译不能使用root用户,所以必须得自己添加一个用户:

adduser openwrt

然后在openwrt用户下使用sudo:

sudo apt update

会报这个错误:

openwrt is not in the sudoers file. This incident will be reported

这是因为openwrt 不在管理组,没有sudo的权限.

解决的办法也很简单,在root用户下把openwrt加入sudo组即可

usermod -aG sudo openwrt 
# a stands for append, G stands for Group, usually use aG together

再或者使用visudo命令,这个命令其实就是编辑/etc/sudoers

往下拉,看到这一行

#User privilege specification

root ALL=(ALL:ALL) ALL

在root的下面添加上自己的用户名:

#User privilege specification

root ALL=(ALL:ALL) ALL

username ALL=(ALL:ALL) ALL

保存退出即可

 

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.