Passing environment variables to sudo

You can pass environment variables such as $PYTHONPATH to sudo like this:

sudo env PYTHONPATH=$PYTHONPATH /some/python/script

October 27, 2008. Tags: , . Linux. Leave a comment.