【发布时间】:2022-03-11 11:04:50
【问题描述】:
我想运行简单的命令来测试 ssh 连接。有关于标准输入/输出/错误的错误。代码和错误信息如下。
有人可以帮我吗?
代码
import paramiko
import sys
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('x.x.x.x', port=2222, username='user', password='pass')
stdin, stdout, stderr = client.exec_command('exit')
print stdout
client.close()
错误信息
Traceback (most recent call last):
File "C:/Users/EXT03D3912/PycharmProjects/paramiko_ssh1/paramiko_ssh1.py", line 9, in <module>
stdin, stdout, stderr = client.exec_command('exit')
File "build\bdist.win32\egg\paramiko\client.py", line 343, in exec_command
File "build\bdist.win32\egg\paramiko\channel.py", line 212, in exec_command
File "build\bdist.win32\egg\paramiko\channel.py", line 1081, in _wait_for_event
EOFError
谢谢, 哈克丹
【问题讨论】:
标签: python ssh stdin paramiko execcommand