Macox cannot use sudo,/etc/sudoers is world writable

1. Recently, I don"t remember when it is better than the permission problem. When I use sudu today, I find it can"t be used. I keep prompting the following error

.
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

in the next search, I found a lot of articles, most of which were CSDN, but none of them could be solved, and some of them even broke the system.
finally found a solution. The original link: to solve the problem of sudoers permissions on macOS

.

1. We want to open root users:
system preferences-> users and groups-> Login options-> Network account Server-> join-> Open Directory Utility-> unlock-> Top menu bar-> Edit-> enable Root users, set root password
2. Enter

at the terminal
su root 

then execute:

chomd 555 /etc/sudoers
exit

then you can enter the sudo command

Mar.17,2022

chomd 555 / etc/sudoers

this will lead to security risks, which should be changed to 440, and both users and groups are root, as follows

-r--r----- ... root root ...  /etc/sudoers
Menu