I have this scenario:
Local host --------- jump-host ------- target computer
I am trying to write Python code using Paramiko for the first SSH from the local host to jump-host, and then SSH from jump-host to the target computer. From the target machine, I want to capture some output and save it locally, either as a variable or as a file (I have not reached this point yet). I found an example from where they talk about using embedded SSH with Paramiko, and I follow it, but I'm stuck here:
My code is:
enter code here
When I run above, I get this error:
$ python sshvm.py Traceback (most recent call last): File "sshvm.py", line 28, in <module> jhost.load_host_keys('/home/osmanl/.ssh/known_hosts') File "/usr/lib/python2.7/site-packages/paramiko-1.15.2-py2.7.egg/paramiko/client.py", line 121, in load_host_keys self._host_keys.load(filename) File "/usr/lib/python2.7/site-packages/paramiko-1.15.2-py2.7.egg/paramiko/hostkeys.py", line 94, in load with open(filename, 'r') as f: IOError: [Errno 2] No such file or directory: '/home/osmanl/.ssh/known_hosts'
Usman source share