Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm having problems adding a user to the sudoers list via the /etc/sudoers file.

$ whoami
iain

And they said I was crazy!

$ 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

The file opens in 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

I save the file. It shows "unchanged" here because I'd already done it.

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

Log in as yvonne…

$ sudo su - yvonne

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

Try to run anything via 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.**

I'm perplexed, can anyone give me any help or insight so that I can give the yvonne account access to sudo? It would be much appreciated.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

% is the group assignment operator in sudoers. I think you want the line to read:

yvonne         ALL=(ALL) ALL
share|improve this answer
    
You are right. The group has been added as yvonnes, which is why this didn't work at all, so a typo has led to me learning something. Many thanks. –  Iain Aug 2 '13 at 18:52
    
Zypher is correct. "%yvonne" means all members of the "yvonne" group. This may work in your case if your user is a member of a group with the same name as your user. –  Insyte Aug 2 '13 at 18:53
    
@Insyte yes, previously all users have had a corresponding group with the same name added. This one had a typo because I set it up on the fly with someone trying to micromanage me over my shoulder :/ Unhelpful, but now I've fixed 2 problems with one question so things are looking up! :) –  Iain Aug 2 '13 at 18:57

Your Answer

 
discard

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.