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

In the sudoers file, how can I use multiple Tag_Specs on the same line.

Normally if I don't want to ask for a password I will do something like this:

who  where = (aswhom) NOPASSWD: commands

I want to use the SETENV tag so that users can preserve environment variables. This works fine like this:

who  where = (aswhom) SETENV: commands

From the sudoers(5) man page:

    Tag_Spec ::= ('NOPASSWD:' | 'PASSWD:' | 'NOEXEC:' | 'EXEC:' |
                  'SETENV:' | 'NOSETENV:' | 'LOG_INPUT:' | 'NOLOG_INPUT:' |
                  'LOG_OUTPUT:' | 'NOLOG_OUTPUT:')

I can't see how I can use multiple tags on the same entry. I would both like to use NOPASSWD and SETENV on the same line.

share|improve this question
up vote 14 down vote accepted

The same commands:

who  where = (aswhom) NOPASSWD:SETENV: commands

The different commands:

who  where = (aswhom) NOPASSWD: command1, SETENV: command2
share|improve this answer
Thank you, works as expected. It's obvious now but I couldn't see it before. – David Feb 19 '13 at 4:54
@quanta What if this isn't working as expected? I have who where = (aswhom) NOPASSWD:SETENV: commands but I'm still being prompted for a password – Colorado Techie Jul 29 '15 at 21:06
@ColoradoTechie seems like it's a different case, please provide details in a separate question. – tutuDajuju Oct 20 '15 at 17:54

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.