I want to change $PATH environment variable from paramiko SSH session. I tried following code but, it is not changing the path.
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('xxx.xxx.xxx.xxx', username='xxxxxx', password='xxxxxx')
ssh.exec_command("export PATH=/tmp:$PATH")
ssh.exec_command("echo $PATH")
I have a binary file 'sysinfo' which calls other binaries. So, I want to change PATH environment variable to precede all others paths with /tmp directory and place my file in /tmp which that binary file requires, so that it executes it. But its not changing the $PATH. After I check the output of "echo $PATH" it still shows-
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
I also tried appending "export PATH=/tmp:$PATH" in .bashrc file and running "source .bashrc". It didn't work.
And finally I tried running
ssh.exec_command("export PATH=/tmp:$PATH /bin/sysinfo")
And this too didn't work.