执行sudo -i,提示如下信息

[centos@localhost ~]$ sudo -i
[sudo] password for centos: 
centos is not in the sudoers file.  This incident will be reported.

1.执行su,输入当前登录的用户密码,密码不可见,直接输入按回车

[centos@localhost ~]$ su
Password: 

2.进入目录 cd /etc/sudoers,如果找不到,执行命令 chmod u+w /etc/sudoers,接下来编辑文件

vi /etc/sudoers

[root@localhost centos]# cd /etc/sudoers
bash: cd: /etc/sudoers: Not a directory
[root@localhost centos]# chmod u+w /etc/sudoers
[root@localhost centos]# vi /etc/sudoers

3.找到root    ALL=(ALL)       ALL

        Tips

1.查找字符串 按:/root  回车,就可以查找root关键字的文本,按“n”查找下一个,按“p” 查找上一个;

2.输入文本,按“i

3.保存“:wq

在下面一行加入一下任意行,username 为当前用户名

username ALL=(ALL) ALL
%username ALL=(ALL) ALL
username ALL=(ALL) NOPASSWD: ALL
%username ALL=(ALL) NOPASSWD: ALL

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

4.再次执行  sudo -i 就成功了

sudo 执行报错centos is not in the sudoers file. This incident will be reported.相关推荐

  1. Centos普通用户权限报错:** is not in the sudoers file. This incident will be reported.

    在centos下有一个普通用户hadoop,在用hadoop创建文件夹: [hadoop@localhost /] sudo mkdir /soft [sudo] password for hadoo ...

  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. ubuntu下执行sudo命令提示:xx is not in the sudoers file. This incident will be reported.

    在执行sudo命令时会有如下提示: xx is not in the sudoers file. This incident will be reported. 原因分析:一般这种情况是修改了用户名, ...

  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. centos普通用户权限问题解决:hadoop is not in the sudoers file. This incident will be reported.

    我在centos下有一个普通用户hadoop,在用hadoop创建文件夹: [hadoop@localhost  /] sudo mkdir  /soft [sudo] password for ha ...

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

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

  9. CentOS下添加Root权限用户‘超级用户’方法(xxx is not in the sudoers file.This incident will be reported.的解决方法)

    文章目录 1.添加普通用户 2.添加sudo文件的写权限 3.编辑sudoers文件 4.撤销sudoers文件写权限 1.添加普通用户 [root@server ~]# useradd fxd // ...

最新文章

  1. zabbix4.0搭建(基于CentOS6.8)
  2. 表的插入、更新、删除、合并操作_16_ 删除表中所有记录
  3. 1036 跟奥巴马一起编程 (15 分)(c++)C++
  4. JVM学习笔记之-运行时数据区概述及线程概述,程序计数器(PC寄存器),虚拟机栈(栈,局部变量表,操作数栈,动态连接,方法调用,方法返回地址等),本地方法接口,本地方法栈
  5. 微软Build 2018展示Visual Studio功能:跨系统云编程
  6. HDU 1284 钱币兑换问题 (动态规划 背包方案数)
  7. C++学习札记(1)
  8. 小程序·云服务的系统架构和运维实现
  9. Linux文件系统下的分区和挂载
  10. nmap扫描器的使用
  11. 【Lingo】线性规划
  12. java uploadify 参数_Uploadify的一些参数
  13. js原生touch事件实现微信语音按住录音,上滑取消。
  14. git报错warning: Clone succeeded, but checkout failed
  15. js将 一串数字1403149534转换为日期格式
  16. mfc 标题栏 标题字体 居中显示
  17. 第三章 标准单元库(下)
  18. SPA单页面应用首屏加载速度提升方法
  19. 应力奇异,你是一个神奇的应力!
  20. WinForm的控件二次开发

热门文章

  1. Unity3d延时执行程序的方法
  2. 领券中心项目,我是如何用 Redis 做实时订阅推送的?
  3. android之爬取正方教务管理系统获取信息
  4. block与copy关系的恩怨情仇,你就不想知道吗?
  5. 阿里云计算、浪潮集团
  6. java用虹软人脸识别SDK实现人脸识别,运行ArcSoft的Java版本Demo出错,未检出人脸
  7. 如何使用OneNote和draw.io来写数学笔记|我的记录小技巧
  8. DCMM数据管理能力成熟度评估详细介绍
  9. BOC保护的苯丙氨酸锌卟啉(Zn·TAPP-Phe-BOC)/铁卟啉(Fe·TAPP-Phe-BOC)/镍卟啉(Ni·TAPP-Phe-BOC)/锰卟啉(Mn·TAPP-Phe-BOC)齐岳科普
  10. 详解 HTTPS、TLS、SSL、HTTP区别和关系