Brett
Brett

Reputation: 12007

linux - Append LD_LIBRARY_PATH for all users

I need to append a few paths to my LD_LIBRARY_PATH variable. This is very simple to do on a per user basis by adding export LD_LIBRARY_PATH=... to my ~/.bashrc file. However, I would like to have this added for all users.

Is there a place I can add the export LD_LIBRARY_PATH=... so that the environment variable will be appended for all users?

Thanks!

Upvotes: 1

Views: 3658

Answers (2)

John Meacham
John Meacham

Reputation: 821

You can add it to the global /etc/profile, but this may not be the solution you are looking for. LD_LIBRARY_PATH has some pitfalls, such as being dropped for setuid binaries and not being indexed by the ld.so cache.

If you just want to add global system-wide library paths, the correct place to do them is in the /etc/ld.so.conf file which is just a list of directories. after you add to it, be sure to run 'ldconfig' as root to scan the new directories.

Upvotes: 2

Simon Richter
Simon Richter

Reputation: 29586

You can add the path to /etc/ld.so.conf.

If this is about third party software in a non-standard install path, you may want to look at the stow utility instead, which is a symlink farming helper that will help you catch name conflicts between installed software.

Upvotes: 3

Related Questions