更新 sudoers 后用户仍然无权访问 sudo

Iai*_*ain 0 sudo osx-snow-leopard

我在通过 /etc/sudoers 文件将用户添加到 sudoers 列表时遇到问题。

$ whoami
iain
Run Code Online (Sandbox Code Playgroud)

然后他们说我疯了!

$ which visudo
/usr/sbin/visudo

$ ls -la /usr/sbin/visudo
---x--x--x  1 root  wheel  186768 23 Jun  2009 /usr/sbin/visudo


$ sudo su -
Password:
macbook:~ root# whoami
root
macbook:~ root# visudo
Run Code Online (Sandbox Code Playgroud)

该文件在 vi 中打开:

# this line is the one I added to sudoers
# I gave ALL as access to try and get this to work
# it's the same setting as my account, which works.
%yvonne         ALL=(ALL) ALL
Run Code Online (Sandbox Code Playgroud)

我保存文件。它在这里显示“未更改”,因为我已经完成了。

visudo: /etc/sudoers.tmp unchanged
macbook:~ root# logout
Run Code Online (Sandbox Code Playgroud)

以 yvonne 身份登录...

$ sudo su - yvonne

yvonne@87 02/08/2013 19:34 $ whoami
yvonne
Run Code Online (Sandbox Code Playgroud)

尝试通过sudo以下方式运行任何东西:

yvonne@88 02/08/2013 19:34 $ sudo ls

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
**yvonne is not in the sudoers file.  This incident will be reported.**
Run Code Online (Sandbox Code Playgroud)

我很困惑,谁能给我任何帮助或见解,以便我可以授予yvonne帐户访问权限sudo?将不胜感激。

Zyp*_*her 6

%是 sudoers 中的组赋值运算符。我认为您希望该行阅读:

yvonne         ALL=(ALL) ALL
Run Code Online (Sandbox Code Playgroud)