Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally screwed up my sudoers file and I don't know where the changes I made are. I know how to get a new sudoers file to that location but the problem is that I don't know what is in it. So to help me, can you please first write the version of OS X you are running and then go into terminal. You have to type these commands that are separated by lines:

cd /etc

sudo cp sudoers ~

Then just open the sudoers file which is in your home directory and copy the text and put it in your reply.

share|improve this question
There's no need to copy the file. sudo cat /etc/sudoers will reveal the content immediately. Also note that you'll be able to break your sudo installation if you don't use visudo. – Sebastian Stumpf May 14 '12 at 3:14
Also check if you didn't change the permissions. Obviously, you should take more care in the future when messing with system files and working as root, which shows in the commands you gave us. There's no need to be root to copy the file somewhere else. – slhck May 14 '12 at 7:42
And since Mac OS X ships with various open-source components (including sudo), you could have found your defaults here: – Sebastian Stumpf May 17 '12 at 6:27

I'm running Mac OS X Lion 10.7.3.

Here's my sudoers file:

# sudoers file.
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
# See the sudoers man page for the details on how to write a sudoers file.

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification
Defaults    env_reset
Defaults    env_keep += "BLOCKSIZE"
Defaults    env_keep += "COLORFGBG COLORTERM"
Defaults    env_keep += "__CF_USER_TEXT_ENCODING"
Defaults    env_keep += "LINES COLUMNS"
Defaults    env_keep += "LSCOLORS"
Defaults    env_keep += "SSH_AUTH_SOCK"
Defaults    env_keep += "TZ"
Defaults    env_keep += "EDITOR VISUAL"
Defaults    env_keep += "HOME MAIL"

# Runas alias specification

# User privilege specification
root    ALL=(ALL) ALL
%admin  ALL=(ALL) ALL

# Uncomment to allow people in group wheel to run all commands
# %wheel    ALL=(ALL) ALL

# Same thing without a password
# %wheel    ALL=(ALL) NOPASSWD: ALL

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.