1.在Mac中启动root 账户
https://jingyan.baidu.com/article/49711c619e7620fa441b7ca8.html
2.切换到root用户,修改 /etc/sudoers的权限
1 #无法使用chmod修改权限 2 demo:Desktop piaoyu.qiu$ ls -la /etc/sudoers 3 -rwxrwxrwx 1 root wheel 1371 8 9 11:28 /etc/sudoers 4 demo:Desktop piaoyu.qiu$ chmod 440 /etc/sudoers 5 chmod: Unable to change file mode on /etc/sudoers: Operation not permitted 6 7 #切换到root用户 8 demo:Desktop piaoyu.qiu$ su 9 Password:你自己设置的密码 10 sh-3.2# ls -l /etc/sudoers 11 -rwxrwxrwx 1 root wheel 1371 8 9 11:28 /etc/sudoers 12 sh-3.2# chmod 0440 /etc/sudoers 13 sh-3.2# ls -l /etc/sudoers 14 -r--r----- 1 root wheel 1371 8 9 11:28 /etc/sudoers 15 sh-3.2# exit
本文介绍在Mac系统中如何启动并切换到root用户,以及如何正确修改/etc/sudoers文件的权限,解决尝试直接使用非root用户进行权限修改时遇到的'Operation not permitted'错误。
2162

被折叠的 条评论
为什么被折叠?



