Python SSH Paramiko EOFError

时间:2017-10-19 15:33:15

标签: python ssh paramiko eoferror

我只有简单的脚本,可以通过SSH在诺基亚路由器上连接并执行命令“show time”:

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('adres ip', port=22, username='username', password='password')
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('show time')
output = stdout.readlines()
print '\n'.join(output)
ssh.close()

登录节点成功。我看到自己在路由器上,但​​执行命令是行不通的。我得到这样的错误:

Traceback (most recent call last):   File "C:\Users\pkudalsk\Desktop\pyt.py", line 6, in <module>
    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('show time')   File "C:\Users\pkudalsk\Desktop\paramiko\client.py", line 479, in exec_command

    chan.exec_command(command)   File "C:\Users\pkudalsk\Desktop\paramiko\channel.py", line 63, in _check
    return func(self, *args, **kwds)   File "C:\Users\pkudalsk\Desktop\paramiko\channel.py", line 241, in exec_comman d
    self._wait_for_event()   File "C:\Users\pkudalsk\Desktop\paramiko\channel.py", line 1198, in
_wait_for_ event
    raise e EOFError

有谁知道什么会导致这个问题?我试过python 3.6和2.7。同样的结果。

由于

0 个答案:

没有答案