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

Whenever I use the sudo command, none of my environment variables appear to be preserved.

I've tried modifying the sudoers file, by removing the env_reset specification.

#Defaults   env_reset

I've also tried adding the env variable that I want using env_keep.

Defaults   env_keep += "DYLD_LIBRARY_PATH"

I'm using Mac Snow Leopard.

Is there something that I am missing?

share|improve this question

1 Answer 1

DYLD_LIBRARY_PATH seems to be excluded from the Defaults env_keep += "Defaults env_keep += "DYLD_LIBRARY_PATH" "

If you try any other variable it works for example Defaults env_keep += "VAR"

You can probably get over this by providing DYLD_LIBRARY_PATH on the commandline for example (where cmd is the command you want to pass DYLD_LIBRARY_PATH)

# sudo DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH cmd

Hope this helps

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.