xxx is not in the sudoers file. This incident will be reported.
来源:互联网 发布:mac android sdk 路径 编辑:程序博客网 时间:2024/06/06 09:51
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.
解决方案如下:
使用
su -
命令切换到root用户(注意有- ,这和su是不同的,在用命令su
的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用su -
命令将环境变量也一起带过去,就像和root登录一样),输入root的密码。输入
visudo -f /etc/sudoers
打开sudoers文件,可以看到前面有这样一行注释:# This file MUST be edited with the ‘visudo’ command as root.
这是因为
visudo
会检查语法错误,而vi
或者nano
之类的命令不会检查错误。将光标移到最下面,查找有没有这样的一行文本
#includedir /etc/sudoers.d
,如果有的话继续第3步,否则跳到第4步,对于前者,文件开始处一般会有这样的注释,提示你最好不要直接修改/etc/sudoers文件:# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.对于存在
#includedir /etc/sudoers.d
的情况,把修改内容添加到新的文件。Ctrl + X
退出当前文件,执行cp /etc/sudoers.d/README /etc/sudoers.d/my_sudoers
复制一个文件,文件名可以自己定,这里是my_sudoers
,使用visudo -f /etc/sudoers.d/my_sudoers
打开文件,可以看到文件开始有这样的注释(来自README文件):# Note that there must be at least one file in the sudoers.d directory (this
# one will do), and all files in this directory should be mode 0440.我们的配置文件是从README复制过来的,所以满足这里的条件,把以下代码加入文件末尾(其中xxx是你的用户名),
Ctrl + X
再Y
再Enter
保存退出即可:# User privilege specification
xxx ALL=(ALL:ALL) ALL对于不存在
#includedir /etc/sudoers.d
的情况,找到root ALL=(ALL:ALL) ALL
,复制一行放在下面,把前面的root改成你的用户名,Ctrl + X
再Y
再Enter
保存退出即可。
参考文档:
- Sudoers - Community Help Wiki
- Ubuntu技巧之 is not in the sudoers file解决方法_Linux教程_Linux公社-Linux系统门户网站
- Linux用户配置sudo权限(visudo) - 怀揣梦想,努力前行 - 博客频道 - CSDN.NET
- linux下的visudo命令 - 曾经有你的森林 - 博客频道 - CSDN.NET
- /etc/sudoers - asnjudy - 博客园
- Fix the problem:xxx is not in the sudoers file.This incident will be reported
- xxx is not in the sudoers file. This incident will be reported (解决办法)
- xxx is not in the sudoers file. This incident will be reported的解决方法
- XXX is not in the sudoers file. This incident will be reported.
- sodu时提示:XXX is not in the sudoers file. This incident will be reported
- xxx is not in the sudoers file. This incident will be reported的错误解决方案
- centos 修改xxx is not in the sudoers file. This incident will be reported
- xxx is not in the sudoers file. This incident will be reported的解决方法
- xxx is not in the sudoers file. This incident will be reported.
- XXX is not in the sudoers file. This incident will be reported.
- xxx is not in the sudoers file. This incident will be reported.
- xxx is not in the sudoers file. This incident will be reported的解决方法
- xxx is not in the sudoers file. This incident will be reported的解决方法
- xxx is not in the sudoers file This incident will be reported
- xxx is not in the sudoers file.This incident will be reported.的解决方法
- xxx is not in the sudoers file. This incident will be reported.
- xxx is not in the sudoers file. This incident will be reported
- xxx is not in the sudoers file.This incident will be reported.的解决方法
- 测试java反射机制
- Qt中的多线程技术
- 【Android】屏幕自适应4种方法
- 日期差值——一种快速的求解方法(Hash的思想)
- shell脚本学习笔记(三)—— if、xargs、awk
- xxx is not in the sudoers file. This incident will be reported.
- SIFT特征提取分析
- CHROME插件
- Android 内存分析命令
- Linux_Shell 输出带颜色的字体(一) 利用tput
- 关于CSS中的块级元素以及行级元素
- Linux帮助命令和用户管理命令
- 第九周项目2- 对称矩阵压缩存储的实现与应用(2)
- sublime Text的使用