Link to home
Start Free TrialLog in
Avatar of barryc
barryc

asked on

LD_LIBRARY_PATH global settings

I want to add to the LD_LIBRARY_PATH of all users on the
system (or at least cause the system to look in additional
directories besides /usr/lib with or without the
LD_LIBRARY_PATH environment variable).

I need to do this even for users who don't have a shell
(e.g.: user nobody).  That means I can NOT use /etc/.login
to set the LD_LIBRARY_PATH environment variable for all
users.

I need to do this on Solaris 2.5.1 and Solaris 2.6.  Is
there an /etc config file that will let me set the search
path for shared libraries on these operating systems, and
if so how do I set it up?

-Barry M. Caceres
Avatar of szetoa
szetoa

Try setting the LD_LIBRARY_PATH in /etc/.profile.
Avatar of barryc

ASKER

Will that work if the user doesn't have a shell??? Doesn't
"sh" source the /etc/.profile, and therefore don't you need
a shell?  

I need this to work for user "nobody" whom the web server runs
as.  BUT, "nobody" does not have a shell.

Avatar of barryc

ASKER

Giving "nobody" a shell is NOT an option for security reasons.

If they don't have a shell, where do they need then this variable?
Avatar of barryc

ASKER

I don't necessarily need the variable.  I need programs that
are run as "nobody" to be able to load dynamic libraries in
a non-standard directory (ie: not in /usr/lib).

The web server runs as "nobody" and all cgi programs in turn
run as nobody.  If these cgi programs need a shared library
that are not in /usr/lib then I want them to be able to find
them.

I need a solution that does NOT involve copying or linking the
libraries to /usr/lib or /usr/local/lib.

Avatar of barryc

ASKER

Adjusted points to 350
You could compile your CGI programs with the -R option, then they wouldn't need LD_LIBRARY_PATH to find the libraries.
didn't

   $ENV{'LD_LIBRARY_PATH'} .= ":/your/path";


work?
Any programs which need to be run can be wrapped in a shell wrapper which actively sets LD_LIBRARY_PATH. Alternatively, you can always link your programs in such a way that they can find the appropriate DLLs.  man ld.
Why not create a (symbolic) link in /usr/lib, pointing to your .so files?

kind regards,

Jos aka jos@and.nl
ASKER CERTIFIED SOLUTION
Avatar of ksb
ksb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial