5
4
I modified /etc/sudoers (using visudo) to keep environment variables :
Defaults !env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
#includedir /etc/sudoers.d
www ALL = NOPASSWD: /usr/bin/env
This works almost well : all environment variables are preserved, except PYTHONPATH !
www@myhost:~$ env | grep PYTHON
PYTHONPATH=/home/www/python_commons:/home/www/python_commons/django_commons/apps:/home/www
www@myhost:~$ sudo env | grep PYTHON
www@myhost:~$
I tried to add that in sudoers :
Defaults env_keep += "PYTHONPATH"
But it does not help.
I am using Ubuntu 11.10 : how to preserve PYTHONPATH ?