MAC下解决sudo: /etc/sudoers is owned by uid 501, should be 0的问题
来源:互联网 发布:大数据建模 编辑:程序博客网 时间:2024/05/21 20:23
今天不慎更改了/etc/sudoers文件,导致终端下执行sudo指令就会出现如下错误
sudo: /etc/sudoers is owned by uid 501, should be 0sudo: no valid sudoers sources found, quitting
这真是个很恶心的错误,其实就是普通用户编辑了,导致root用户无法调用sudo这个命令,但是又不能直接更改它的权限
后来百度了一下,找到一个解决办法,亲测有效,因此转载分享给大家
首先需要重启系统,在黑屏的时候就长按
Command + S直到出现苹果标志,就可以松开按键,有可能系统会让你输入开机密码,输入密码后进入Root单用户模式
经过一些启动代码滚动后,系统提示你可以输入如下指令进入可写模式
/sbin/fsck -fy
输入后会执行一些磁盘检测,过后就可以执行重新获取权限的指令了
依次输入
mount -uw /chown root:wheel /etc/sudoerschmod 440 /etc/sudoers这样root用户就会重新获取sudoers的权限,一定要按照上面的指令输入,拥有者必须为root:wheel,权限设置必须为440,任何其他操作都会导致sudo指令的不可用
输入完成后就可以重新启动系统了,最后输入
reboot系统会重启,再次进入桌面后调用终端,就会发现sudo指令恢复正常了
原帖地址
部分参考
0 0
- MAC下解决sudo: /etc/sudoers is owned by uid 501, should be 0的问题
- MAC下解决sudo: /etc/sudoers is owned by uid 501, should be 0的问题
- sudo: /etc/sudoers is mode 0540, should be 0440解决
- sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
- sudo: /etc/sudoers is mode , 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 0777, 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 0640, should be 0440解决办法
- sudo: /etc/sudoers is mode 0640, should be 0440解决办法
- sudo: /etc/sudoers is mode 0640, should be 0440解决办法
- ubuntu sudo: /etc/sudoers is mode 0777, should be 0440问题
- sudo: /etc/sudoers is mode 0640, should be 0440的解决方法
- ubuntu 12.04 遇到sudo: /etc/sudoers is mode 0777 , should be 0440的解决办法
- Ubuntu问题sudo: /etc/sudoers is mode 0640, should
- 禅道-从windows7迁移至ubuntu14.04之一
- 解决windows下 cd 无法切换盘符目录
- Java学习之路一
- TotoiseSVN-小乌龟的使用方法
- AVStream介绍
- MAC下解决sudo: /etc/sudoers is owned by uid 501, should be 0的问题
- App 为什么收不到推送?
- android apk的大小优化
- 新版Emoji表情过滤
- centos7 部署配置tomcat7
- IntelliJ IDEA 16 本地LicenseServer激活(破解)
- inet_aton和inet_network和inet_addr
- meta基础知识
- CSU 1780 简单的图论问题?