在ubuntu中有一个主账号,称为管理账号,有sudo权限,可以在服务器上用 “sudo ***” 安装一些package, 或执行一些其他的需要权限的命令。

一般来说,除了主账号以外的其他成员没有sudo权限。但是有时其他账号成员有时也需要安装一些package,要用到sudo权限。 而在执行 “ sudo ***” 命令时,就会遇到如题所示的异常。

而每次用sudo权限都要麻烦主账号十分不方便。所以,可以通过以下方案解决这个问题: 把这个可信赖的用户user_name添加到 /etc/sudoers文件中,这样user_name用户就可以使用sudo权限了,也就解决了题目所示的问题。

具体的操作步骤如下(需要主账号下操作):

# 1,更新root用户的密码,该命令执行后,系统会提醒你为root用户设置密码
sudo passwd root# 2. 进入root用户,系统会要求输入上面设置的root账户密码
su# 3. 把某个特定账户 user_name 添加到sudoer文件中
sudo adduser user_name sudo# 4. 退出root账户,切换到user_name用户
su user_name_main

但是我在按照上述操作后,user_name仍旧不能使用sudo,我又按照以下步骤,我又执行以下步骤,手工把user_name添加到sudoers文件中,具体操作步骤如下:

# 1. 进入root账户
su# 2. 为sudoers文件添加写权限,因为sudoers文件默认是只读的
chmod u+w /etc/sudoers# 3. 编辑sudoers文件
vi /etc/sudoers
# 在文件中找到 root ALL = (ALL)  ALL,这一行,
# --》在键盘上点击i进入编辑模式
# 在他下面添加 xxx ALL=(ALL) ALL (这里的xxx是你的用户名),具体可见下图
# --》编辑完后,键盘上点击 Esc 键,退出编辑模式,输入 “:wq!” 保存内容并退出vi编辑器#4. 撤销 /etc/sudoers的写权限
chmod u-w /etc/sudoers# 5. 切换用户,退出root账户
su wzg  # wzg是要进入的用户账户名

第三步中的操作示例,在etc/sudoers中添加yakong用户,使yakong用户拥有sudo权限。

现在为止,大功告成,打完收功。我的问题完美解决了。

** is not in the sudoers file. This incident will be reported. 给某个用户开放sudo权限。相关推荐

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

  2. xxx is not in the sudoers file.This incident will be reported.的解决方法

    xxx is not in the sudoers file.This incident will be reported.的解决方法 参考文章: (1)xxx is not in the sudoe ...

  3. How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu

    How to Fix "Username is not in the sudoers file. This incident will be reported" in Ubuntu ...

  4. [已解决]user is not in the sudoers file. This incident will be reported.(简单不容易出错的方式)

    linux Ubuntu中报错,XXX is not in the sudoers file. This incident will be reported. 今天在学习的时候,不小心把自己的用户su ...

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

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

  6. 解决xx is not in the sudoers file. This incident will be reported.问题

    问题.  xxx is not in the sudoers file. This incident will be reported.(当想要以 xxx的身份切换到root权限时,使用sudo su ...

  7. 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"错误,解决 ...

  8. xxx is not in the sudoers file. This incident will be reported

    问题描述: 新建用户执行命令sudo chmod 700 ,提示输入root命令. 输入三次错误. 提示 yourid is not in the sudoers file. This inciden ...

  9. xxx is not in the sudoers file. This incident will be reported.

    sudo,用其他用户的身份执行命令. 运行该命令时,系统首先检查/etc/sudoers,判断该用户是否有执行sudo的权限,在确定有执行权限后,要求输入自己的密码(当前用户),如果密码正确,会以ro ...

最新文章

  1. Linux上安装jdk并配置环境变量
  2. 感知和行动的贝叶斯模型
  3. aMSN 0.97问题解决一则
  4. 百货中心供应链管理系统
  5. 分布式查询的使用准则
  6. Go 语言 Session机制和 Cookie机制
  7. 安全扫描工具​Nmap引擎理解文档
  8. 【Python+selenium Wendriver API】之鼠标悬停事件
  9. python开发config层_Python全栈开发:configparser模块
  10. php 返回页面重复提交,php防止表单重复提交
  11. html5编辑器新手用,3款容易上手的HTML5编辑工具推荐~
  12. 上周热点回顾(6.5-6.11)
  13. python心理学实验程序_心理学实验程序编程(python)
  14. 如果使用Node.js不存在该如何创建目录?
  15. mysql覆盖索引和回表
  16. rtmp代理php源码_RTMP直播系统(示例代码)
  17. 怎么把mp3转换成wav?
  18. HDFS中NameNode和DataNode的作用
  19. 金额换算(数字换汉字)
  20. 构建人工智能评测平台(体系)

热门文章

  1. ubuntu19.04支持android,Ubuntu 19.04 最终发布日期和计划功能公布
  2. linux的工程管理器是,Linux工程管理器——make
  3. docker 网络配置_Kafka的AWS Docker网络设置
  4. python数字组合算法_python猜数字游戏快速求解解决方案
  5. apache 网站转nginx_堡塔网站加速宝塔面板网站加速安装设置使用教程
  6. 电脑测试软件_科普丨电脑小白必看的显卡测试小技巧
  7. 思科模拟器叫什么_宇宙无敌上帝视角无所不能之星球生成模拟器。
  8. html代码放进json数据,用json数据填充html表
  9. MongoDB独特查询
  10. jdk和jre和jvm区别_JDK,JRE和JVM之间的区别