Você pode esperar que você possa fazer isso usando
Defaults env_keep += "LD_LIBRARY_PATH FRED"
mas um teste rápido em CentOS 6.2
com Sudo version 1.7.4p5
não passa LD_LIBRARY_PATH
, mas passa FRED
. A página man sudoers tem isso a dizer
Note that the dynamic linker on most operating systems will remove variables that can control dynamic linking from the environment of setuid executables, including sudo. Depending on the operating system this may include _RLD, DYLD_, LD_, LDR_, LIBPATH, SHLIB_PATH, and others. These type of variables are removed from the environment before sudo even begins execution and, as such, it is not possible for sudo to preserve them
Parece que o sistema remove o LD_LIBRARY_PATH
do ambiente antes que o sudo o veja.