【发布时间】:2020-07-25 22:10:01
【问题描述】:
我正在尝试使用 Paramiko 进入服务器,然后进入服务器中的路由器,然后运行命令。
但是,我没有输入路由器的密码,然后它就关闭了连接。
username, password, port = ...
router = ...
hostname = ...
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.WarningPolicy)
client.connect(hostname, port = port, username = username, password = password)
cmd = # ssh hostname@router
# password input comes out here but gets disconnected
stdin, stdout, stderr = client.exec_command(cmd)
HERE # command to run in the router
stdout.read()
client.close()
有什么帮助吗?
【问题讨论】: