I accidentalley deleted the sudoers file on Mac OS X; is there any way to recover it?
And once you've recovered it, how do you set it to mode 0440?
I presume not but I am desperate to get it back!
I'm assuming you are trying to run a
If you have previously granted your account
If you did not put yourself in the
If I understand your problem correctly then currently you don't have sudoers and you are trying to do sudo and its not working. In this case to get sudo working you can do the following :
To check sudo is running fine
I know this is a bit surprising that even after not having sudoers, via UI we can do operations in /etc. But it worked for me :)
Enable the root user using system preferences, and then create /etc/sudoers while logged in as the root user.
touch /etc/sudoers; chmod 440 /etc/sudoers
Then use visudo to insert this code into it:
If you aren't an admin, you can boot the system into single-user-mode instead (if you don't know how to do this, just google it) and do the command
and you will be in the root terminal