Linux执行sudo命令提示用户名不在 sudoers 文件中
Debian 11 安装完后,通过终端执行命令,提示错误:xxx 不在 sudoers 文件中。此事将被报告。解决办法:
·
Debian 11 安装完后,通过终端执行 sudo
命令,提示错误:
xxx 不在 sudoers 文件中。此事将被报告。
解决办法(:
- 终端输入 su 回车,输入 root 密码,回车,切换到 root 用户
- 打开 sudoers 文件:nano /etc/sudoers
- 找到 # Allow members of group sudo to execute any command,在 %sudo ALL=(ALL:ALL) ALL 下面添加 xxx ALL=(ALL:ALL) ALL,xxx 为前面无法执行 sudo 命令的用户名。注:按Ctrl+W后输入”Allow members”后回车进行搜索,添加完后按提示依次按下Ctrl+X、Y、Ctrl+M保存修改并退出。
注:没有nano命令可通过vim /etc/sudoers或vi /etc/sudoers打开文件,修改完用Esc+:+wq!强制保存(即依次按Esc键、:、w、q、!)。保存后文件自动生效。
更多推荐
已为社区贡献1条内容
所有评论(0)