参考: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. java 学习路线、java 入门、java自学、java 教程

    以前学习知识都是用到什么学什么,不是很系统.今天看到一个网站感觉挺不错的,分享给大家. 这个页面是学习路线功能的简介,如下图 ​ 点击选择学习路线 ​ 进入后可以选择循序渐进或者由终至始 ​ 上图标出 ...

  2. Notepad++编辑器——Verilog、代码片段、F6编译

    Notepad++是一款精致小巧的编辑器,自带Verilog语法识别功能,插件也挺好用的.这里陈列一下我的设置. 版本:Notepad++ 7.6.6 ,32位 //================= ...

  3. LD_PRELOAD和ld --wrap

    前言 LD_PRELOAD和ld --wrap都能实现不修改原始代码,替换指定函数的实现.通常我们会使用这些方法,替换如malloc)()/free().read()/write()等函数,并在替换函 ...

  4. unsqueeze 和 squeeze

    squeeze压缩的意思 就是在第几维为1 去掉 unsqueeze 解缩 在第几维增加 变成*1 squeeze用法 c = b.view(1, 1, 1, 2, 3) c.squeeze(0) # ...

  5. React中控制台警告

    1.dll_lib.js:1 Warning: bind(): You are binding a component method to the component. React does this ...

  6. 设计一个完美的http缓存策略

    1.前言 作为一个前端,了解http缓存是非常必要,它不仅是面试的必要环节,也更是实战开发中必不可少需要了解的知识点,本文作者将从缓存的概念讲到如何在业务中设计一个合理的缓存架构,带你一步一步解开ht ...

  7. hive concat_ws源代码

    其他相关源码可以到以下链接查看: https://github.com/apache/hive/tree/master/ql/src/java/org/apache/hadoop/hive/ql/ud ...

  8. Python学习 之 Python入门

    第二章 Python入门 2.1 环境安装 2.1.1 下载解释器: py2.7.16 (2020年官方不再维护) py3.6.8 (推荐安装) 1.下载解释器一定去官网下载,https://www. ...

  9. Linux相关安装文档

    一.JDK环境安装 1.查看linux上是否存在已安装好的JDK (1)java -version openjdk version "1.8.0_181"OpenJDK Runti ...

  10. MQTT服务器(Win)

    系统环境准备 Java JDK >=1.6,系统环境变量配置JAVA HOME 链接:https://pan.baidu.com/s/1OO-KCdsCrdfjMtf6BVNl6Q 提取码:dy ...