Python: How can remote from my local pc to remoteA to remoteb to remote c using Paramiko

前端 未结 1 486
一整个雨季
一整个雨季 2020-12-07 06:11

I would like to know how to to jump from one remote server to another remote server using paramiko. I want to ssh from my local pc to remote-A then from remote-A to remote-B

相关标签:
1条回答
  • 2020-12-07 06:34

    use for pexpect module it is very useful for you http://www.noah.org/wiki/pexpect and and pexpect module simplified in pxssh module that very good for remote login http://dsnra.jpl.nasa.gov/software/Python/site-packages/Contrib/pxssh.html simple code:

    import pxssh
    host = pxssh.pxssh
    host.login('hostname','username','password')
    host.sendline('command')#'ls'
    print host.before
    
    0 讨论(0)
提交回复
热议问题