Solved

LD_LIBRARY_PATH global settings

Posted on 1998-10-02
11
1,152 Views
Last Modified: 2013-12-27
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
0
Comment
Question by:barryc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 1

Expert Comment

by:szetoa
ID: 2007182
Try setting the LD_LIBRARY_PATH in /etc/.profile.
0
 

Author Comment

by:barryc
ID: 2007183
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.

0
 

Author Comment

by:barryc
ID: 2007184
Giving "nobody" a shell is NOT an option for security reasons.

0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007185
If they don't have a shell, where do they need then this variable?
0
 

Author Comment

by:barryc
ID: 2007186
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.

0
 

Author Comment

by:barryc
ID: 2007187
Adjusted points to 350
0
 
LVL 2

Expert Comment

by:mlev
ID: 2007188
You could compile your CGI programs with the -R option, then they wouldn't need LD_LIBRARY_PATH to find the libraries.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007189
didn't

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


work?
0
 
LVL 3

Expert Comment

by:braveheart
ID: 2007190
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.
0
 
LVL 4

Expert Comment

by:jos010697
ID: 2007191
Why not create a (symbolic) link in /usr/lib, pointing to your .so files?

kind regards,

Jos aka jos@and.nl
0
 
LVL 1

Accepted Solution

by:
ksb earned 350 total points
ID: 2007192
If you really want to fix this you can.  What ever is starting the processes that run as "nobody" needs to have the environment variable in question set.  For example "inetd" might be the process.

Find the start of the daemon in /etc/init.d/* and add a line to set LD_LIBRARY_PATH at the start of the daemon.  If you really want to go nuts replace /etc/init (after you move it to /etc/Init) with a C program that sets the environment the way you like it and evecve's the real init.  This is wacko dangerous on a Vendor system (easy if you have source to init).

On FreeBSD thete is a login.conf that lets you set $VARs for everyone.

-- ksb
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question