Using Channels with Paramiko

后端 未结 1 1932
梦如初夏
梦如初夏 2021-01-07 13:26

I am working on converting a tool from Ruby to Python, and the Ruby version uses Net::SSH to connect to a remote host, and send commands and retrieve responses/data. I have

相关标签:
1条回答
  • 2021-01-07 14:22

    exec_command() is enough if the SSH server supports running commands (like ssh user@host "cmd; cmd; ...". But some SSH servers (e.g. network devices like switches, routers, ...) only supports starting an interactive session. Then you need to use invoke_shell() which returns a Channel.

    Transport and Channel are all SSH terms (other than Paramiko's). See following RFCs for more info:

    • rfc4251 - The SSH Protocol Architecture
    • rfc4252 - The SSH Authentication Protocol
    • rfc4253 - The SSH Transport Layer Protocol
    • rfc4254 - The SSH Connection Protocol
    0 讨论(0)
提交回复
热议问题