LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-11-2012, 12:00 PM   #1
crosstalk
Member
 
Registered: Jul 2010
Distribution: Gentoo, Debian, Mint, Xubuntu
Posts: 150

Rep: Reputation: 35
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.
 
Old 12-11-2012, 12:23 PM   #2
blueh2o
Member
 
Registered: Jul 2011
Distribution: CentOS, Ubuntu, Fedora, Solaris, RHEL, Debian
Posts: 100

Rep: Reputation: 3
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.

Last edited by blueh2o; 12-11-2012 at 12:25 PM.
 
Old 12-12-2012, 03:52 PM   #3
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by blueh2o View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] trouble setting up sudo to allow su - user zrnaqvi Linux - Security 1 11-16-2009 06:42 PM
Setting the LD_LIBRARY_PATH Mark_667 Linux - Newbie 4 12-17-2008 11:26 AM
sudo not setting defaults brainlesspinkey Linux - Security 4 09-11-2005 11:34 AM
Permanently Set a Export Setting (LD_LIBRARY_PATH) nistelrooy Linux - General 1 11-25-2004 11:33 AM
setting LD_LIBRARY_PATH JonyKyte Linux - Newbie 1 02-14-2004 12:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration