You are not logged in.

#1 2005-02-22 02:40:58

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 165

su and export

I have written a file that sets some variables for my oracle 10g instant client.
file: /etc/profile.d/oracle-instant-client.sh

export ORACLE_HOME=/usr/lib/oracle/10.1.0.3/client
export LD_LIBRARY_PATH=/usr/lib/oracle/10.1.0.3/client/lib

Now this works for a normal user but when using "su" the LD_LIBRARY_PATH disappears. Why is this?

Offline

#2 2005-02-22 03:11:58

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: su and export

use

su -m

man su


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-02-22 03:17:40

skoal
Member
From: Frequent Flyer Underworld
Registered: 2004-03-23
Posts: 612
Website

Re: su and export

I don't think the preserve parent shell environment is what he needs.

I think even if he does use this, it won't work.

If I'm not mistaken, LD_LIBRARY_PATH will never be inherited by subshells.  This has to do with the suid bit on terms, keeping a well known exploit from occuring.

I think that's the case here...

sol'n? you got me...

I'd stick that library path in "/etc/ld.so.conf" and be done with it.  I don't know if that's what you need though.

Offline

#4 2005-02-22 13:09:52

mmccaskill
Member
From: NC
Registered: 2005-02-21
Posts: 165

Re: su and export

Yeah thanks. Sticking it in /etc/ld.so.conf worked great. I need it to get oracle instant client sqlplus to work.

Offline

#5 2005-02-22 18:58:00

skoal
Member
From: Frequent Flyer Underworld
Registered: 2004-03-23
Posts: 612
Website

Re: su and export

When I first read your post, I scratched my head for a second.  I remembered for some reason trying the same thing years ago.  I soon realized you can't, unless you remove the suid bit I think.

Offline

#6 2005-02-23 06:01:34

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: su and export

That's right, as a security thing, suid binaries ignore LD_LIBRARY_PATH.  That way sneaky users can't add their own libraries and have root execute them.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#7 2006-03-05 10:44:58

bogomipz
Member
From: Oslo, Norway
Registered: 2003-11-23
Posts: 169

Re: su and export

I had to hack my way around this a while ago. What I ended up doing was setting LD_LIBRARY_PATH_PROFILE="$LD_LIBRARY_PATH" in .bash_profile, then LD_LIBRARY_PATH="$LD_LIBRARY_PATH_PROFILE" in .bashrc. This worked like charm as long as I started X from the console. When I deployed a display manager I had to include the first assignment in .xinitrc as well.

Would it be a good idea if /etc/profile set LD_LIBRARY_PATH_PROFILE after sourcing all the profile.d scripts? Then all the user would have to do is restore LD_LIBRARY_PATH in .bashrc, it could even be in the default rc, just not for root.


All of your mips are belong to us!!

Offline

Board footer

Powered by FluxBB