【问题标题】:Difference between exec_command in client and channel of Paramiko?客户端中的exec_command和Paramiko的频道之间的区别?
【发布时间】:2021-11-04 04:03:42
【问题描述】:

在Python包Paramiko中,channel.pyclient.py中存在exec_command方法,它们有什么区别?

【问题讨论】:

    标签: python ssh paramiko


    【解决方案1】:

    Channel 是一个低级 API,一般不应使用。

    SSHClient.exec_command 调用 Channel.exec_command,然后创建 stdin/stdout/stderr 对象并将它们作为 3-touple 返回。使用Channel,您必须自己创建这些对象(因为没有它们,Channel.exec_command 将毫无用处)。

    另见Paramiko exec_command fails with 'NoneType' object is not iterable

    此外,SSHClient.exec_command 具有 get_ptyenvironment 参数,分别触发 Channel.get_pty()Channel.update_environment

    检查SSHClient.exec_command source code

    【讨论】:

      猜你喜欢
      • 2016-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-21
      • 1970-01-01
      • 1970-01-01
      • 2017-03-15
      相关资源
      最近更新 更多