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

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

1 Answer 1

up vote 11 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

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.