![Mac OS X /etc/sudoers 默认文件](https://linux22.com/image/1314743/Mac%20OS%20X%20%2Fetc%2Fsudoers%20%E9%BB%98%E8%AE%A4%E6%96%87%E4%BB%B6.png)
我不小心弄乱了我的 sudoers 文件,我不知道我所做的更改在哪里。我知道如何将新的 sudoers 文件放到该位置,但问题是我不知道里面有什么。所以为了帮助我,你能先写出你正在运行的 OS X 版本,然后进入终端吗?你必须输入这些由行分隔的命令:
cd /etc
sudo cp sudoers ~
然后只需打开主目录中的 sudoers 文件并复制文本并将其放入您的回复中。
答案1
我正在运行 Mac OS X Lion 10.7.3。
这是我的 sudoers 文件:
# 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 += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"
Defaults env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"
Defaults env_keep += "LINES COLUMNS"
Defaults env_keep += "LSCOLORS"
Defaults env_keep += "SSH_AUTH_SOCK"
Defaults env_keep += "TZ"
Defaults env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"
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