参考: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. UBuntu sudo 命令 :xxx is not in the sudoers file. This incident will be reported.

    [1]分析问题 提示内容翻译成中文即:用户XXX(一般是新添加的用户名称)没有权限使用sudo. 解决方法修改新用户的权限,具体操作即修改一下/etc/sudoers文件. [2]切换至root用户模 ...

  2. 普通用户开通sudo权限:xxx is not in the sudoers file.This incident will be reported.的解决方法

    1.切换到root用户下,怎么切换就不用说了吧,不会的自己百度去. 2.添加sudo文件的写权限,命令是: chmod u+w /etc/sudoers 3.编辑sudoers文件 vi /etc/s ...

  3. Linux 'XXXXXX' "is not in the sudoers file. This incident will be reported" 解决方法

    添加方法如下: 1.进入root模式su -  注意:su和-之间有空格输入当前用户的密码 2.添加写权限chmod u+w /etc/sudoers 3.将自己加入到sudoers中 gedit / ...

  4. Linux中添加管理员权限问题:xxx is not in the sudoers file. This incident will be reported.

    在各个不同版本的linux中添加拥有管理员权限账户有不同的简便方式. 问题: 今天遇见将新添用户添加到root用户组后,运行sudo仍然提示 ”xxx is not in the sudoers fi ...

  5. 解决linux下sudo更改文件权限报错xxxis not in the sudoers file. This incident will be reported.

    本文转自Linux社区作者为z-sm的文章 原文链接http://www.linuxidc.com/Linux/2016-07/133066.htm 之前一直使用的是ubuntu,后来安装了Cento ...

  6. sudo 提示 'xxx is not in the sudoers file.This incident will be reported.的解决方法'

    在使用 Linux 的过程中,有时候需要临时获取 root 权限来执行命令时,一般通过在命令前添加 sudo 来解决. 但是第一次使用 sudo 时,有可能会得到这样一个错误提示 xxx is not ...

  7. Linux遇到的问题(一)Ubuntu报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法

    提示错误信息 www@iZ236j3sofdZ:~$ ifconfig Command 'ifconfig' is available in '/sbin/ifconfig' The command ...

  8. Linux ->> <user_name> not in the sudoers file. This incident will be reported.

    昨天在用sudo命令执行mkdir命令的时候发生了错误.错误提示如下: hadoop@master:/home$ sudo mkdir /home/hadoop [sudo] password for ...

  9. xxx is not in the sudoers file.This incident will be reported.的解决方法 (一般用户不能执行sudo)

    1.切换到root用户下 2.添加sudo文件的写权限,命令是:chmod u+w /etc/sudoers 3.编辑sudoers文件vi /etc/sudoers找到这行 root ALL=(AL ...

随机推荐

  1. JMS入门简介

    一.JMS是什么 1.JMS即Java消息服务(Java Message Service)应用程序接口,是一个Java平台中关于面向消息中间件(MOM)的API,用于在两个应用程序之间,或分布式系统中 ...

  2. react-navigation报错

    用react-navigation配置路由时,出现如下报错或白屏. 我的代码原来是 import {AppRegistry} from 'react-native'; import App from ...

  3. android ——Toolbar

    Toolbar是我看material design内容的第一个 官方文档:https://developer.android.com/reference/android/support/v7/widg ...

  4. 详解InheritableThreadLocal类的使用与原理

    在Java并发编程中,InheritableThreadLocal 与 ThreadLocal 都可以用于线程间通信,不同的是 InheritableThreadLocal 继承了 ThreadLoc ...

  5. temperatureConversion2

    Solution: #方法一:字符串与列表的相互转换和它们的基本函数操作 n = input() if n[0] in {"C","c"}: a= list(n ...

  6. 关于事务,事务的特性,spring事务的传播特性

    1.什么是事务: 事务是程序中一系列严密的操作,所有操作执行必须成功完成,否则在每个操作所做的更改将会被撤销,这也是事务的原子性(要么成功,要么失败). 2.事务特性: 事务特性分为四个:原子性(At ...

  7. 90002CAD相关操作

    第一章   初识CAD 1.1 CAD能干什么 (1)绘制机械图/建筑图/装修图等二维复杂工程图的不二之选.二维设计软件的王者. (2)CAD可以绘制平面图.轴测图(二维线框表示三维图形).立体图(三 ...

  8. Linux CentOS7 下设置tomcat 开机自启动

    网上有很多教程说是可以设置Tomcat 自启动,但是一一验证了都不行.最后找到一个方法 验证可以: 1.改rc.local   位于/etc/rc.d/文件下的rc.local   vi /etc/r ...

  9. 使用VS Code 开发.NET CORE 程序指南

    1. 前言 近两年来,很多前端的同学都开始将 VSCode 作为前端主力开发工具,其丰富的扩展给程序开发尤其是前端开发带来了很多便利,但是作为微软主力语言的 .NET,却由于有宇宙第一编辑器 Visu ...

  10. python 27 异常处理

    目录 异常处理 1. 错误分类 2. 异常 3. 异常处理 4. 异常处理的两种方法 5. try的结构 5.1 结构一:单分支结构 5.2 结构二:多分支结构 5.3 结构三:万能异常 5.4 结构 ...