Solved

LD_LIBRARY_PATH global settings

Posted on 1998-10-02
11
1,135 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
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

785 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