zoukankan      html  css  js  c++  java
  • 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啦,截图留念:

  • 相关阅读:
    随手
    会使用基本的Render函数后,就会想,这怎么用 v-for/v-if/v-model;我写个vue Render函数进阶
    iframe子页面与父页面元素的访问以及js变量的访问[zhuan]
    vue element-ui 的奇怪组件el-switch
    URLSearchParams和axios的post请求(防忘记)
    ios vue2.0使用html5中的audio标签不能播放音乐
    Unity Input System教程
    关于OpenGPU.org
    Better ultra_simple for Slamtec RPLIDAR on Linux
    八字心得
  • 原文地址:https://www.cnblogs.com/rgever/p/9377046.html
Copyright © 2011-2022 走看看