cenos6.5 xxx is not in the sudoers file. This incident will be reported.
来源:互联网 发布:mac cp 拷贝文件夹 编辑:程序博客网 时间:2024/06/05 18:07
在ubuntu中由于禁用了root用户,默认情况下会把安装系统时建立的用户添加到sudoers中。但在redhat和centos中并没有把任何root用户之外的用户默认的添加到sudoers之中。这样我们在执行sudo 命令时就会出现xxx is not in the sudoers file. This incident will be reported.这样的错误输出。现在为了安全起见比较提倡使用普通用户做日常操作,而在需要超级用户的时候使用sudo 来做,这样,我们就有必要把一些用户添加到sudoers之中。
其实把用户添加到sudoers之中很简单。
首先利用whereis 命令查找sudoers配置文件的目录(默认会在/etc/sudoers)
[root@localhost xiuxi]# whereis sudoers
sudoers: /etc/sudoers /etc/sudoers.bak /usr/share/man/man5/sudoers.5.gz
然后需要切换到root用户,更改/etc/sudoers的权限
[root@localhost xiuxi]# chmod u+w /etc/sudoers
然后就可以利用vi编辑器来把用户添加到sudoers之中
[root@localhost xiuxi]# vi /etc/sudoers
然后找到root ALL=(ALL) ALL所在的位置,把所要添加的用户添加到文件之中,
顺便提一下vi编辑器的用法。刚进入vi编辑器的时候牌命令行模式,这时可以通过方向键来移动光标,找到要编辑的位置之后按下“i”,然后就进入了插入模 式,这时候你可以输入或删除字符。编辑完成之后按“esc”键退出插入模式,进入命令行模式,这时候按“:”可以进入末行模式,输入“wq”保存并退出。
下面是添加完的结果。
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
xiuxi ALL=(ALL) ALL (这一行是添加的内容,xiuxi是我的用户名)
然后需要把sudoers 的写权限去掉(否则系统不允许执行suoders文件):
其实把用户添加到sudoers之中很简单。
首先利用whereis 命令查找sudoers配置文件的目录(默认会在/etc/sudoers)
[root@localhost xiuxi]# whereis sudoers
sudoers: /etc/sudoers /etc/sudoers.bak /usr/share/man/man5/sudoers.5.gz
然后需要切换到root用户,更改/etc/sudoers的权限
[root@localhost xiuxi]# chmod u+w /etc/sudoers
然后就可以利用vi编辑器来把用户添加到sudoers之中
[root@localhost xiuxi]# vi /etc/sudoers
然后找到root
顺便提一下vi编辑器的用法。刚进入vi编辑器的时候牌命令行模式,这时可以通过方向键来移动光标,找到要编辑的位置之后按下“i”,然后就进入了插入模 式,这时候你可以输入或删除字符。编辑完成之后按“esc”键退出插入模式,进入命令行模式,这时候按“:”可以进入末行模式,输入“wq”保存并退出。
下面是添加完的结果。
## Allow root to run any commands anywhere
root
xiuxi ALL=(ALL)
然后需要把sudoers 的写权限去掉(否则系统不允许执行suoders文件):
[root@localhost xiuxi
]# chmod u-w /etc/sudoers
至此,在退出root用户之后就可以利用sudo命令来执行超级用户的权限了 0 0
- cenos6.5 xxx is not in the sudoers file. This incident will be reported.
- 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
- 浅谈MyBatis中的缓存
- ScrollView 的一个小方法
- 关于Android Studio无法查看详细的源代码问题解决
- 第十章 会话管理——《跟我学Shiro》
- 数据结构---单链表
- cenos6.5 xxx is not in the sudoers file. This incident will be reported.
- POJ 1401 Factorial 阶乘0的数量 .
- android之官方下拉刷新组件SwipeRefreshLayout
- 基于spring整合activeMQ以及点对点队列的封装
- 环信iOS使用步骤及使用总结
- View的scrollTo和scrollBy
- 对root安卓设备修改时间的方法
- js刷新页面方法大全
- AndroidListview 滑动过程中图片显示重复错乱解决方案