linux为用户添加sudo权限sudo: /etc/sudoers is mode 0640, should be 0440?”
来源:互联网 发布:数据库添加字段 编辑:程序博客网 时间:2024/04/29 21:25
用sudo时提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了。下面是修改方 法:
1)进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用) ,如果从root切换其他用户如Karry,输入"su Karry".
2)添加文件的写权限。也就是输入命令"chmod u+w /etc/sudoers"。
3)编辑/etc/sudoers文件。也就是输入命令"vim /etc/sudoers",输入"i"进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名);
4)然后保存(就是先按一 下Esc键,然后输入":wq")退出。 此时退出会有错误:E45:'readonly' option isset(add! to override),不能保存编辑后的文件。把保存命令换成:w!sudo tee %,或者:x、:q!均不能保存usrName ALL=(ALL) ALL 这句代码,可以用visudo这个命令替代"vim /etc/sudoders"命令,编辑后用4)保存命令保存即可。至此步普通用户Karry已经可用sudo命令。
5)撤销文件的写权限。也就是输入命令"chmod u-w /etc/sudoers"。
ubuntu或者CentOS中,/etc/sudoer 的权限为 0440时才能正常使用,否则sudo命令就不能正常使用。出现类似:sudo: /etc/sudoers is mode 0640, should be 0440 的对话。
解决办法:
1、Ctrl+Alt+F1 进入文本模式。用超级用户登录,如root
2、输入:chmod 0440 /etc/sudoers 。Enter
3、exit 退出
4、Ctrl+Alt+F7 返回图形模式。
5、在试试sudo命令,可以用了
P:其实另开一个端口,su -进入root,然后chmod 0440 /etc/sudoers
效果是一样的
example:
[BIngo@windows ~]$ sudo chmod u+w /etc/sudoers
口令:
[BIngo@windows ~]$ ls -l /etc/sudoers
-rw-r----- 1 root root 3210 11-16 02:40 /etc/sudoers
[BIngo@windows ~]$ sudo chmod u-w /etc/sudoers
sudo: /etc/sudoers is mode 0640, should be 0440
[BIngo@windows ~]$ ls -l /etc/sudoers
-rw-r----- 1 root root 3210 11-16 02:40 /etc/sudoers
口令:
[BIngo@windows ~]$ ls -l /etc/sudoers
-rw-r----- 1 root root 3210 11-16 02:40 /etc/sudoers
[BIngo@windows ~]$ sudo chmod u-w /etc/sudoers
sudo: /etc/sudoers is mode 0640, should be 0440
[BIngo@windows ~]$ ls -l /etc/sudoers
-rw-r----- 1 root root 3210 11-16 02:40 /etc/sudoers
另开端口
[root@windows ~]# chmod 0440 /etc/sudoers
[root@windows ~]# exit
[BIngo@windows ~]$ ls -l /etc/sudoers
-r--r----- 1 root root 3210 11-16 02:40 /etc/sudoers
[BIngo@windows ~]$ ls -l /etc/sudoers
-r--r----- 1 root root 3210 11-16 02:40 /etc/sudoers
- linux为用户添加sudo权限sudo: /etc/sudoers is mode 0640, should be 0440?”
- sudo: /etc/sudoers is mode 0640, should be 0440解决办法
- sudo: /etc/sudoers is mode 0640, should be 0440解决办法
- sudo: /etc/sudoers is mode 0640, should be 0440解决办法
- sudo: /etc/sudoers is mode 0640, should be 0440解决办法
- sudo: /etc/sudoers is mode 0777, should be 0440
- sudo: /etc/sudoers is mode 0540, should be 0440解决
- sudo: /etc/sudoers is mode , should be 0440的解决办法
- sudo:/etc/sudoers is mode 0777, should be 0440
- Ubuntu问题sudo: /etc/sudoers is mode 0640, should be 0440的解决方法
- sudo: /etc/sudoers is mode 0640, should be 0440的解决方法
- Ubuntu问题sudo: /etc/sudoers is mode 0640, should be 0440的解决方法
- Ubuntu "sudo ... /etc/sudoers is mode 0640, should be 0440"解决方案
- 解决ubuntu里面的sudo: /etc/sudoers is mode 0640, should be 0440
- sudo: /etc/sudoers is mode xxx, should be 0440 sudo: no valid sudoers sources found, quitting
- Ubuntu问题sudo: /etc/sudoers is mode 0640, should
- ubuntu 12.04 遇到sudo: /etc/sudoers is mode 0777 , should be 0440的解决办法
- sudo: /etc/sudoers is mode 0777, should be 0440终极解决之道
- UVA 12545 Bits Equalizer(模拟+贪心)
- vim配置地址链接
- xp 32bit os 只能使用3.2G内存 的变通解决方案
- access vba 用recordset读取表中数据的简单方法
- QT判断是否含有某字符串
- linux为用户添加sudo权限sudo: /etc/sudoers is mode 0640, should be 0440?”
- HDU 4000 Fruit Ninja 【树状数组】
- POJ 2481 - Cows 树状数组离线处理
- access string 字符串处理函数Mid(), Left(), inStr
- 数据库(proc编程)
- 基于baseline和stochastic gradient descent的个性化推荐系统
- 如何在 C# 中用 SharpZipLib 进行 ZIP 压缩与解压
- Objective-C ,ios,iphone开发基础:iosMD5大全
- 杭州某互联网公司校招笔试Java选做题