关于 wsl 系统报 xxx wsl is not in the sudoers file 的解决办法

如题,当不知道啥操作导致 /etc/sudoers 被修改,当前用户被移出了 sudo 组后,在使用sudo xxx 命令时,会报错

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

 

解决办法很简单,把当前用户重新加到sudo用户组里就行了

 

解决办法分两种情况:

一、root 用户设置了密码,并且你知道密码

su root
usermod -aG sudo your_name

 

二、root 用户没有设置密码

当root用户没有设置密码时,使用 su root 是不能切换到 root 用户的

win键+x+a 打开 PowerShell,使用以下命令以root用户打开 linux

wsl -u root

然后

usermod -aG sudo your_name

 


完。

posted @ 2020-10-24 11:05  Tiac  阅读(787)  评论(0)    收藏  举报