Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm trying to set the Defaults in an appropriate way for the pdebuild usage. I've got the command alias defined:

Cmnd_Alias  PBUILDER = /usr/sbin/pbuilder, /usr/bin/pdebuild, /usr/bin/debuild-pbuilder

and I'm trying to set the defaults only for that one:

Defaults        env_reset
Defaults!PBUILDER       env_keep="DIST ARCH"

This fails with syntax error on the line with env_reset. When I comment out the Defaults!PBUILDER line, it works just fine. What should I update here to make it work?

Additional info:

$ sudo -V
Sudo version 1.6.9p17

The man page has information about the "Defaults!..." option so this should be ok in theory.

The whole file is:

Cmnd_Alias  PBUILDER = /usr/sbin/pbuilder, /usr/bin/pdebuild, /usr/bin/debuild-pbuilder

Defaults    env_reset
Defaults!PBUILDER   env_keep="DIST ARCH"

root    ALL=(ALL) ALL

%engineering    ALL=(ALL) ALL
share|improve this question
Can you post the rest of your sudoers file? What you've posted so far looks fine, and works in my sudoers configuration without a problem. Also, what version of sudo are you using? – larsks Feb 15 '11 at 16:40
@larsks - Added the requested info. I'm using debian lenny. – viraptor Feb 15 '11 at 16:50
up vote 1 down vote accepted

I think your man page is out-of-sync with respect to the version of sudo that you're using. I just checked out 1.6.9p23 [aka changeset 5429:f7398cfbac71] from the sudo repository, and the sudoers man page shows the following syntax:

    Default_Type ::= 'Defaults' |
                     'Defaults' '@' Host_List |
                     'Defaults' ':' User_List |
                     'Defaults' '>' Runas_List

There's no mention of the 'Defaults' '!' Cmnd_List syntax available in more recent version. This appears to be an online version of the 1.6.9 man page which shows the same thing.

share|improve this answer
It's there in an example later on, but at the same time, yes, it's missing from the syntax description :/ Some documentation mistake seems to be the most reasonable explanation really. – viraptor Feb 16 '11 at 3:24

Just to add to what larsks has said, I've tried your sudoers file in my sudo (1.7.4p5) and it parses fine, no errors. It's possible that the version you're using doesn't have as sophisticated support for defaults as 1.7, or it may just be a bug. Is upgrading sudo out of the question?

share|improve this answer
Yes, it is out of question. On the other hand, I don't think it's a not-supported option, since this example is in the manpage: # Override built-in defaults {...} Defaults!PAGERS noexec for the same version. – viraptor Feb 15 '11 at 17:07

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.