Ssh remote executing program shared library not found

ssh

I want to write a script to run a program on some machines.
I can login to this machines to execute the program.

But when i tried "ssh -n -f hostname "cd xxx; ./xxx",it printed "error while loading shared libraries: libzmq.so.4".

I googled and i am pretty sure about that i write put the LD_LIBRARY_PATH in .bashrc file and that when i executed ssh -n -f hostname "echo $LD_LIBRARY_PATH",the load path is correctly set.

Does anyone can help me?Thanks a lot!

Best Answer

When logging in using ssh the ~/.bashrc is not source - but the ~/.bash_profile is - so if you set the LD_LIBRARY_PATH in ~/.bashrc you need to have something like this in your ~/.bash_profile:

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

And also, in your ~/.bashrc you may have:

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

If you do, then you need to add the LD_LIBRARY_PATH setting above that in the file.

Related Topic