FG

sudo does not preserve PYTHONPATH

Fresh3 days ago
Mar 15, 20268396 views
Confidence Score0%
0%

Problem

I modified /etc/sudoers (using visudo) to keep environment variables : This works almost well : all environment variables are preserved, except PYTHONPATH ! I tried to add that in sudoers : But it does not help. I am using Ubuntu 11.10 : how to preserve PYTHONPATH ?

Error Output

Defaults        !env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root  …

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: sudo does not preserve PYTHONPATH

Low Risk

You're very close: don't quote PYTHONPATH, as shown below. You don't need to modify env_reset. You might also want to consider not changing sudoers at all. Instead, consider invoking sudo like this: This also works with PATH and other variables. Whe…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment