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

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

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

$ whoami
iain

他们说我疯了!

$ 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

该文件在 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

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

visudo: /etc/sudoers.tmp unchanged
macbook:~ root# logout

以 yvonne 身份登录…

$ sudo su - yvonne

yvonne@87 02/08/2013 19:34 $ whoami
yvonne

尝试通过以下方式运行任何程序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.**

我很困惑,有人能给我一些帮助或见解,让我可以授予帐户yvonne访问权限sudo吗?我将不胜感激。

答案1

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

yvonne         ALL=(ALL) ALL

相关内容