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

For example, there is a line defining the rule in sudoers file:

%wheel ALL=(ALL) NOPASSWD: $HOME/bin/ls

is it valid? If not, is there an equivalent way to achieve this goal?

Thanks.

share|improve this question
    
Are you trying to get $HOME to expand to the user who is running sudo, or the user who is the destination of the sudo (root in this case)? – Sean Reifschneider Oct 21 '11 at 6:00

It is invalid. If you want to keep environment variables when running command via sudo, uncomment/add the following line, for e.g:

Defaults env_keep += "VBOX_APP_HOME"
share|improve this answer

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.