I'm using paramiko on my local to ssh into a unix server. There is an executable file that I would like to launch from my local on the server. The executable currently fails from local/paramiko because the LD_LIBRARY_PATH environment variable isn't set correctly when I ssh using paramiko, however it's set automatically when I use putty and work interactively. When I log into the machine via putty, the executable file works as expected, but when I log in via paramiko from my local, the exectuable returns an error rleated to the LD_LIBRARY_PATH environment not being set correctly.
When I log into the machine using putty, an admin .login file specifies a series of paths for variable LD_LIBRARY_PATH. It looks like this:
setenv LD_LIBRARY_PATH path1:path2:path3:...
However, when logging in via paramiko, this admin script isn't initiated, and I need to manually set the LD_LIBRARY_PATH variable.
My connection looks like:
ssh = pk.SSHClient()
ssh.set_missing_host_key_policy(pk.AutoAddPolicy())
ssh.connect(hostname='server', username='user', password='password')
The command I want to run looks like:
stdin, stdout, stderr = ssh.exec_command('nohup executablefile')
How can I set my LD_LIBRARY_PATH and then execute my program using paramiko's exec_command, or should I be looking for a different function?