This may be one of the rare cases where running “Repair Disk Permissions” from Disk Utility might actually be warranted.
If that doesn’t work, follow @slhck’s suggestion of booting into single user mode to fix it:
Reboot, holding down Command-S to enter single user mode. Note that if you’re using a Bluetooth keyboard, you need to hit this as the boot chime is trailing off. If you hit it too soon, it’s before the Bluetooth radio gets reset and the keyboard loses connection and doesn’t communicate the keypress. If you hit it too late, the boot process will have moved on to multi-user boot.
Follow the instructions on-screen to remount your root drive read-write. You can probably skip the
fsckstep if you rebooted gracefully. So you can probably just type:
mount -uw /
Fix the permissions on
/etc/sudoers. Note that you’re already
rootwhen you’re in single user mode, so you don’t need to
chmod 0440 /etc/sudoers
Exit single user mode by rebooting again, by simply typing:
Another approach is using Automator.app
Create a new workflow that contains something like the following:
do shell script "chmod 0440 /etc/sudoers" with administrator privileges
When you run it, it’ll ask for your password and (presuming you’re an administrator) it’ll fix it.
This also works if you’ve messed up the permissions on a parent directory (eg making / something other than 755).