linux Ubuntu中报错,XXX is not in the sudoers file. This incident will be reported.

今天在学习的时候,不小心把自己的用户sudo玩坏了(Broken sudo),于是上谷歌搜索XXX is not in the sudoers file. This incident will be reported.

看到一些大多数方法都是修改/etc/sudoers文件的内容,由于之前因为修改系统文件除了问题,进入recovery mode又把系统玩崩了(虚拟机),这次我就轻易不想修改系统文件

于是继续看,查到了另一个方法是进入recovery mode修改https://www.tecmint.com/fix-user-is-not-in-the-sudoers-file-the-incident-will-be-reported-ubuntu/
可是我也更不想进入recovery 模式啊~

但我还是仔细的看完了介绍的步骤,继续往下翻,看到许多评论都惊呼用这个方法解决了问题的时候

我再往下翻,看到了一个特别的评论:

简单解释下就是:
0、你的root需要设置好密码
sudo passwd root
像这样,我以一个新用户user1为例:

1、设置好密码之后,就可以切换到root用户:
su root
这里root可以省略,默认就是切换root
像这样

2、输入如下指令,将用户名添加到sudoers文件
sudo adduser image sudo
这里的image是我要恢复的用户名,你应该输入你想要恢复的用户名,像这样

3、su image(ctrl+d)切回到在使用的用户

此时用户image就被添加到了sudoers文件了,又可以使用sudo了:
使用sudo对用户进行修改:

于是完成,congratulation!果然高手在民间,评论区还是要多逛逛~

[已解决]user is not in the sudoers file. This incident will be reported.(简单不容易出错的方式)相关推荐

  1. 解决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 ...

  2. 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 ...

  3. xxx is not in the sudoers file.This incident will be reported.的解决方法

    xxx is not in the sudoers file.This incident will be reported.的解决方法 参考文章: (1)xxx is not in the sudoe ...

  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. XXXX is not in the sudoers file. This incident will be reported解决方法

    假设你用的是Red Hat系列(包括Fedora和CentOS)的Linux系统.当你执行sudo命令时可能会提示"某某用户 is not in the sudoers file.  Thi ...

  6. 【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 ...

  7. user is not in the sudoers file. This incident will be reported 解决方法

    Ubuntu版本,在一般用户下执行sudo命令提示user is not in the sudoers file. This incident will be reported.解决方法:       ...

  8. XXXX is not in the sudoers file. This incident will be reported解决方法

    XXXX is not in the sudoers file.  This incident will be reported解决方法 假设你用的是Red Hat系列(包括Fedora和CentOS ...

  9. 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 ...

最新文章

  1. 【莫队算法】bzoj3781 小B的询问
  2. 5G与数据中心是新基建“耗电双雄”?事情不能这么看……
  3. [C++]怎么样实现一个较快的Hash Table
  4. qt udp多线程收发过程_! udp多线程的有关问题
  5. 同步/异步阻塞/非阻塞
  6. devops开发运维一体化_进阶 | 中国电信系统集成公司:100% 应用 DevOps 理念,做好企业级行业应用...
  7. java中异常的定义_java中异常的理解
  8. C#设置鼠标光标为自定义图片
  9. python 时间戳转各时区时间
  10. Apple Watch Series 8功能介绍 watch series 8续航
  11. 雷电模拟器忘记锁屏密码
  12. python读excel并写入_Python读取Excel文件并写入数据库
  13. models.__dict__[args.model]()
  14. LQ0076 既约分数【GCD】
  15. android 观察者模式的简单demo,一个简单的demo彻底搞懂观察者模式
  16. 发票盖章不清晰,盖了两个章怎么办?官方说法来了
  17. 探路者战略合作oTMS 布局智慧物流
  18. 基于springboot的酒店预订管理系统(源代码+数据库+10000字文档) 002
  19. 【时空融合:遥感图像】
  20. NeRF in the Wild

热门文章

  1. backtrader2
  2. 股票期货数据的resample处理
  3. Spring boot + mybatis plus 快速构建项目,生成基本业务操作代码。
  4. 软件测试中的存根程序
  5. Diango博客--23.单元测试:测试 blog 应用
  6. Pandas常用操作总结
  7. [转]VisualStudio如何组织解决方案的目录结构
  8. typedef的使用方法
  9. hdu max sum
  10. python 编程模型