I've installed a program, Player, and am now trying to run the player
command.
The player requires a .cfg file as input, e.g
player create.cfg
I notice that I am able to run the above command fine as a normal user, but when I run it as root,
sudo player create.cfg
I get the following error:
error while loading shared libraries: libplayerdrivers.so.3.0: cannot open shared object file: No such file or directory
My question is, why would the command work when running it as a normal user, but not when running it as a root user? I would understand if it were the other way round. What gives?
I know the error usually means the LD_LIBRARY_PATH is not set right. The shared object in question is in /usr/local/lib
, so I put the command
EXPORT LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
in my .bashrc file and sourced it. But running the player
command with sudo
still fails to find it.
Doing ls -l /usr/local/lib | grep libplayerdrivers
gives the following output:
lrwxrwxrwx 1 root root 23 Jun 27 16:34 libplayerdrivers.so -> libplayerdrivers.so.3.0
lrwxrwxrwx 1 root root 25 Jun 27 16:28 libplayerdrivers.so.3.0 -> libplayerdrivers.so.3.0.2
-rw-r--r-- 1 root root 3042066 Jun 27 16:28 libplayerdrivers.so.3.0.2
sudo overwrites LD_LIBRARY_PATH, because it is a security risk.