在执行sudo命令时会有如下提示:

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

原因分析:一般这种情况是修改了用户名,没有对应修改sudoers文件或者group文件。

解决方法:

方法1:

如果除了root用户,还有别的用户,可以切换到别的用户,然后切换到root用户下,修改sudoers文件。

执行visudo命令,vi和sudo之间没有空格。或者vi  /etc/sudoers 命令,增加用户。

方法2:

使用 su -命令(有空格,用"su"命令只是切换到root,而没有把root的环境变量传过去,实际是当前用户的环境变量,用"su -"命令会将环境变量传过去,和root登录效果一样),然后修改sudoers文件即可(visudo)。如果出现如下情况,别慌,只需要先进入recovery mode,然后修改sudoers文件即可。

ubuntu进入recovery mode请参考: recovery mode

注:

username      ALL=(ALL:ALL) ALL                       #用户需要输入密码执行sudo命令

%groupname     ALL=(ALL) AL                             #用户组里的用户输入密码执行sudo命令

username  ALL=(ALL) NOPASSWD: ALL           #用户免密执行sudo命令

%groupname  ALL=(ALL) NOPASSWD: ALL      #用户组里的用户andy免密执行sudo命令

ubuntu下执行sudo命令提示:xx is not in the sudoers file. This incident will be reported.相关推荐

  1. centos/Linux 解决使用sudo命令时xxx is not in the sudoers file.This incident will be reported

    解决方法 切换到root用户: su 然后在root用户下输入命令: chmod u+w /etc/sudoers vim /etc/sudoers 在vim编辑器界面输入/root查询到这一行: r ...

  2. 解决xx is not in the sudoers file. This incident will be reported.问题

    问题.  xxx is not in the sudoers file. This incident will be reported.(当想要以 xxx的身份切换到root权限时,使用sudo su ...

  3. 【sudo错误】xxx is not in the sudoers file.This incident will be reported解决

    文章目录 1.问题 2.分析 3.解决方法 3.1 手动修改 3.2 命令方式修改--sudo visudo 4.扩展说明 1.问题 xxx is not in the sudoers file.Th ...

  4. Ubuntu报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法

    Ubuntu下普通用户用sudo执行命令时报"xxx is not in the sudoers file.This incident will be reported"错误,解决 ...

  5. Hadoop之——Linux下sudo命令报错:hadoop is not in the sudoers file. This incident will be reported.

    转载请注明出处:https://blog.csdn.net/l1028386804/article/details/93380235 当在终端执行sudo命令时,系统提示"cuser is ...

  6. sudo 执行报错centos is not in the sudoers file. This incident will be reported.

    执行sudo -i,提示如下信息 [centos@localhost ~]$ sudo -i [sudo] password for centos:  centos is not in the sud ...

  7. Linux中新建用户用不了sudo命令问题:rootr is not in the sudoers file.This incident will be reported解决

    Linux中新建用户用不了sudo命令问题:rootr is not in the sudoers file.This incident will be reported解决 参考:https://b ...

  8. How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu

    How to Fix "Username is not in the sudoers file. This incident will be reported" in Ubuntu ...

  9. ubuntu下执行sudo apt-get install python-pip 出现错误 Unable to locate package python-pip

    ubuntu13.04下执行sudo apt-get install python-pip 出现以下错误: E: Unable to locate package python-pip 解决办法: 摘 ...

最新文章

  1. 基于前后端分离的Nginx+Tomcat动静分离
  2. gin的Bindxxx和ShouldBindxxx的区别
  3. 寻找第k大的元素Java,java – 支持快速第k个最大元素查找的队列数据结构
  4. 《Dotnet9》系列-Google ProtoBuf在C#中的简单应用
  5. 认知智能,AI 的下一个十年 | AI Procon 2020
  6. 前端开发 V8引擎是什么?
  7. layui,返回的数据不符合规范,正确的成功状态码 (code) 应为:0
  8. 三次hermite插值多项式例题_数值分析实验六(分段三次Hermite插值)
  9. 2020编程入门先学什么
  10. iTunes备份文件路径修改方法
  11. graphpad导出图片不居中_Graphpad如何导出期刊所需图
  12. Photoshop十种抠图方法
  13. springboot项目结构_从零搭建Spring Boot脚手架(1):开篇以及技术选型
  14. 使用jbe修改jar中class中的内容
  15. VIPKID壁垒破碎:境外外教课包将下线,核心竞争力消失?
  16. Git如何生成SSH密钥
  17. 网络配置中rc.d-rc6.d的说明
  18. andorid Telephony 整体介绍
  19. 时间单位:s cs ms us ns ps fs as zs js ys 普朗克
  20. 得移动互联网者得天下

热门文章

  1. nyoj 1237 最大岛屿(dfs)
  2. 希望计算机专业都知道这些优质比赛
  3. NAT原理与NAT穿透
  4. 2021年河南高考--各高校在河南录取分数线预测(本科一批——理科):
  5. 凤凰涅槃,浴火重生(2013年总结)
  6. 漏洞挖掘之 SQL 注入挖掘
  7. css:overflow-x: overlay火狐浏览器不生效没有滚动条出现
  8. java配置环境变量path(JAVA配置环境变量失败)
  9. Excel 对表格的某一列数据进行名次排序
  10. 通达信波段顶底指标公式,抓到真正顶底并且绝对精准可能吗?