Nested SSH with Paramiko and RSA key file

后端 未结 1 1604
迷失自我
迷失自我 2021-01-15 21:00

I am trying to nested SSH using Paramiko where I will connect to Server X from my local machine and from there I will connect to Server Y. Here to connect to Server X I am u

1条回答
  •  时光说笑
    2021-01-15 21:22

    You cannot use port forwarding to implement the jump, if you need to use a private key stored on the jump server.

    • Either download the key to the local machine. If you do not want to physically store the key on the local machine, you can download it to memory in your Python code only. See Loading key from an SSH jumphost using Paramiko.

    • Otherwise you would have to implement the jump by running ssh client on the jump server, which will pick up the private key stored there (what is normally a lame solution):

      ssh.exec_command("ssh root@Y pwd")
      

    0 讨论(0)
提交回复
热议问题