LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-13-2006, 05:12 AM   #1
sperlis
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Rep: Reputation: 0
exporting LD_LIBRARY_PATH problem


Hi all,
I've defined and exported LD_LIBRARY_PATH from .bash_profile. It is built as follows (lets assume it's user1):

Code:
EVN1=${HOME}/version
export ENV1

ENV2=$/home/user2/version
export ENV2

LD_LIBRARY_PATH=${ENV1}/lib:${ENV2}/lib:/usr/local/lib
export LD_LIBRARY_PATH
Everything works well, until I su (no -). After switching to super-user, the environment variables ENV1 and ENV2 are proper:
ENV1 == /home/user1/version
ENV2 == /home/user2/version

However, LD_LIBRARY_PATH is not defined (the bash does not recognize it). I assume the shell treats LD_LIBRARY_PATH in a special way, but I'm not sure how to override it.

Anyone has any ideas?
thanks,
 
Old 12-13-2006, 06:26 AM   #2
sn68
Member
 
Registered: Oct 2005
Distribution: FC5
Posts: 338

Rep: Reputation: 30
You will have to add & export the LD_LIBRARY_PATH in root .bash_profile also, since .bash_profile is user specific

Last edited by sn68; 12-13-2006 at 06:27 AM.
 
Old 12-13-2006, 09:23 AM   #3
sperlis
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Please note that I used "su" not "su -". As far as I understand, "su" alone does not invoke the bash scripts. I would like to maintain the environment variables values from user1, while gaining super-user permissions.
ENV1 and ENV2 are retained, while LD_LIBRARY_PATH is lost.

thanks,
 
Old 12-14-2006, 09:34 AM   #4
sperlis
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Sorted!

LD_LIBRARY_PATH is deleted when changing temporarily to root whether it is exported or not. This is done even when using su without the -. It is done, for example, when running a program with the sticky-bit turned on.
How to go around it:
You can create a temporary variable that is a copy of LD_LIBRARY_PATH in the user. In the root's .bashrc set LD_LIBRARY_PATH to the temporary variable (which is maintained passed the su command).
Just remember that this is certainly a security hole which can be exploited by malicious software and you should really-really want to do it.
 
  


Reply

Tags
export, ldlibrarypath


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in exporting batabase in phpPGAdmin........ chillyroll Linux - Software 3 10-27-2006 10:22 AM
LD_LIBRARY_PATH problem mac1234mac Programming 2 03-17-2006 02:42 PM
LD_LIBRARY_PATH problem lsropia Linux - Software 5 08-11-2005 01:44 PM
Problem with exporting/firewall , RPC: No route to host pinguscot Linux - Networking 1 11-05-2004 06:29 AM
Problem exporting X. nidua18 Linux - Software 0 10-21-2003 11:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:21 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration