当前位置:   article > 正文

Linux 用户使用sudo时 显示xxx is not in the sudoers file.This incident will be reported.的解决方法_is not in the sudoers file. this incident will be

is not in the sudoers file. this incident will be reported.

1.切换到root用户下,su -

2.添加sudo文件的写权限,命令是:
chmod u+w /etc/sudoers

3.编辑sudoers文件
vi /etc/sudoers
找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)

ps:这里说下你可以sudoers添加下面四行中任意一条

youuser            ALL=(ALL)                ALL  
%youuser           ALL=(ALL)                ALL  
youuser            ALL=(ALL)                NOPASSWD: ALL  
%youuser           ALL=(ALL)                NOPASSWD: ALL  
  • 1
  • 2
  • 3
  • 4

第一行:允许用户youuser执行sudo命令(需要输入密码).
第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.

4.撤销sudoers文件写权限,命令:
chmod u-w /etc/sudoers

这样普通用户就可以使用sudo了.

补充:

注意,在Ubuntu系统下,Unix操作系统并没有为root创建密码,需要使用sudo passwd root来为root用户配置密码,之后才可以登入。


分享一个有趣的 学习链接:https://xxetb.xet.tech/s/HY8za

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号