Sample Header Ad - 728x90

Have I corrupted my sudoers file? Cannot use sudo command at all

1 vote
2 answers
419 views
I think I may have corrupted my sudoers file. At any rate I can no longer use the sudo command (always hangs). I've read other questions related to this topic and tried to fix (going into Recovery mode for ex) but feels like I don't know what I'm doing. Pretty sure I caused the problem by using chmod to grant permissions too widely to a folder. This is not uncommon apparently. Running things like sudo visudo or sudo lsof -i yield: sudo: /private/etc/sudoers.d is world writable This is a brand new macbook M3 btw. Was working on getting nginx going, but the certbot process wrote the wretched file to a dir unexpected by the instructions I was following, and log revealed that permission was being denied to private/etc. Trying to obtain permission there with Finder and Terminal is what caused this. **UPDATE:** my /private/etc folder's permissions now seem to have been corrected, as per advice from Linc D below. But although invoking sudo no longer responds with sudoers.d is world writable, it now simply hangs. I think the problem is now with the /etc/sudoers, but the permissions on /etc seem to be messed up. Looks like this. Notice difference between it and /private/etc enter image description here
Asked by Alyoshak (111 rep)
Apr 16, 2024, 05:57 PM
Last activity: Feb 12, 2025, 02:07 AM