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

参考:https://blog.csdn.net/lichangzai/article/details/39501025

如果执行sudo命令的用户没有执行sudo的权限,执行sudo命令时会报下面的错

[rootr@localhost ]# sudo yum install gcc-c++ 
rootr is not in the sudoers file.This incident will be reported

设置用户执行sudo命令权限,建议这些操作都在secureCRT内进行要不然当走到进入sudoers那一步时,会出现问题
方法如下:    
1、进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。

2、添加文件的写权限。也就是输入命令"chmod u+w /etc/sudoers"。

3、编辑/etc/sudoers文件。也就是输入命令"vim /etc/sudoers",输入"i"进入编辑模式,
找到这一行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),比如我这里是rootr所以我的语句是:rootr ALL=(ALL) ALL

如果要让执行时不需要输入密码,再找到下面这一句
# %wheel  ALL=(ALL)       NOPASSWD: ALL

并去掉注释#:
%wheel  ALL=(ALL)       NOPASSWD: ALL

然后保存(就是先摁一下Esc键,然后输入":wq")退出。

4、将你的用户(普通用户)调整至“ wheel ”用户组里面。
gpasswd -a YourUserName wheel

这样,就可以每次执行 sudo 命令时不再输入密码了

5、撤销文件的写权限。也就是输入命令"chmod u-w /etc/sudoers"。

[oracle@dev ]$ su root
[root@dev ]# chmod u+w /etc/sudoers
[root@dev ]# vim /etc/sudoers
[root@dev ]# chmod u-w /etc/sudoers
[root@dev ]# gpasswd -a rootr wheel

[root@dev ]# su rootr

截图:

之后就可以执行sudo啦,截图留念:

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

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

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

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

  4. Linux ** is not in the sudoers file. This incident will be reported.

    Linux 报错: ** is not in the sudoers file. This incident will be reported. 错误原因 顾名思义,该用户没有在 sudoers fi ...

  5. 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. 原因分析:一般这种情况是修改了用户名, ...

  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. ** is not in the sudoers file. This incident will be reported. 给某个用户开放sudo权限。

    在ubuntu中有一个主账号,称为管理账号,有sudo权限,可以在服务器上用 "sudo ***" 安装一些package, 或执行一些其他的需要权限的命令. 一般来说,除了主账号 ...

  8. Linux下dpkg的用法,linux中管理包的apt和dpkg命令用法

    1,apt-get命令 apt-get是debian,ubuntu发行版的包管理工具,与红帽中的yum工具非常类似,适用于deb包管理式的操作系统,主要用于自动从互联网的软件仓库中搜索.安装.升级.卸 ...

  9. suse 新增用户oracle,在SUSE Linux中让其他用户能运行Oracle命令

    SUSE Linux中让其他用户能运行Oracle命令的方法介绍: suid/guid的问题: 要求非Oracle用户也能运行sqlplus等oracle命令. 解决方法: 假如希望设置s u i d ...

最新文章

  1. mysql加入新的从节点怎么配置_MySql主从复制配置
  2. 全球及中国工业水性涂料行业销售前景与竞争态势研究报告2022年
  3. 2011年上海交通大学计算机研究生机试真题
  4. 谈谈设计模式的几个原则
  5. 软件工程 团队博客作业 如何评价个人在团队中的绩效
  6. 案例:使用正则表达式的爬虫
  7. java string对象放在什么区域_java中String对象的存储位置
  8. BZOJ 2763[JLOI2011]飞行路线 - 最短路
  9. 折线图_Pyecharts数据可视化分析—折线图
  10. “金三银四”跳槽需谨慎!
  11. 计算机如何建筑材料结合所学知识,《技术与设计2》第三、四单元检测试卷
  12. javaSocket编程TCP
  13. ESP8266 WIFI模块
  14. Flutter 使用 GetIt 容器将新增和编辑后的数据同步更新到列表
  15. Cisco Packet Tracer路由器ip简单配置(网关)
  16. IM即时通讯聊天软件1.0
  17. 计算机网络笔记Part3 数据链路层(Data Link Layer)
  18. 【动手学深度学习】李沐——循环神经网络
  19. 汽车驾驶学习-驾驶技巧:图解如何安全停车的技巧
  20. cisco Switching-vlan

热门文章

  1. 一文详解AI模型部署及工业落地方式
  2. 性能SOTA、适用多种类型物体,国防科技大学单张RGB-D图像预测物体对称性
  3. 重磅直播|慕尼黑工业大学博士详解室内SLAM中的几何约束
  4. ECCV2020 最佳论文提名 | 流感知技术
  5. Zora P1测评报告-Tsrjrc
  6. np.reshape()
  7. JMC | 人工智能在药物合成中的当前和未来作用(1)
  8. python批处理修改文件的名字
  9. EL:固氮能力主要取决于物种分类而不是土壤养分
  10. NAR:扩增子OTU聚类软件SeekDeep方法解读