LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Sudo -- setting LD_LIBRARY_PATH (http://www.linuxquestions.org/questions/linux-software-2/sudo-setting-ld_library_path-4175440994/)

crosstalk 12-11-2012 12:00 PM

Sudo -- setting LD_LIBRARY_PATH
 
I need to run an application via sudo. This application needs access to libraries -- however, sudo strips LD_LIBRARY_PATH, even if you allow it via env_keep or tell it not to wipe the environment.

Sudo allows you to work around this same issue for $PATH via the "secure_path" setting in a sudoers file -- is there an equivalent for the LD_LIBRARY_PATH variable, or am I stick using an alias to do this? I'm aware that there are possible security issues.

blueh2o 12-11-2012 12:23 PM

From the man page of sudoers(5):

Quote:

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.
I would suggest you create a wrapper script for your application that sets up the environment as needed and then calls your application.

linosaurusroot 12-12-2012 03:52 PM

Quote:

Originally Posted by blueh2o (Post 4847127)
create a wrapper script for your application that sets up the environment as needed and then calls your application.

Then configure sudo to call the wrapper.


All times are GMT -5. The time now is 11:24 AM.