Solved

LD_LIBRARY_PATH global settings

Posted on 1998-10-02
11
1,128 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
 
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now