12

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.

1 Answer 1

23

The same commands:

who  where = (aswhom) NOPASSWD:SETENV: commands

The different commands:

who  where = (aswhom) NOPASSWD: command1, SETENV: command2
3
  • Thank you, works as expected. It's obvious now but I couldn't see it before.
    – David
    Feb 19, 2013 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 Jul 29, 2015 at 21:06
  • @ColoradoTechie seems like it's a different case, please provide details in a separate question.
    – tutuDajuju
    Oct 20, 2015 at 17:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .