【发布时间】:2016-04-08 19:28:18
【问题描述】:
我通过以下方式连接到我的远程计算机:
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.client.connect(hostname=ip_address, username=self.user, password=self.password, look_for_keys=False)
当我发送命令时:
chan = self.client.get_transport().open_session(timeout=timeout)
chan.request_x11()
chan.settimeout(timeout)
chan.exec_command(command)
stdin = chan.makefile('wb', -1)
stdout = chan.makefile('r', -1)
stderr = chan.makefile_stderr('r', -1)
return stdin, stdout, stderr
如果我不使用这条线:
chan.request_x11()
我尝试使用:
self.client.exec_command(command)
但同样的错误
我从标题中收到错误消息。当我使用这条线时,我在尝试从标准输出读取时得到一个超时连接。我试过设置
DISPLAY=:0
什么也没做。我正在尝试通过 ssh 发送 dbus 命令。当我通过终端手动连接 ssh 时,我可以使用 -X 或不使用它,我可以使用我的 dbus 调用,这没关系。
【问题讨论】: