【发布时间】:2020-01-01 04:07:30
【问题描述】:
我使用 Paramiko 连接到服务器并希望列出输出。但它只显示了一半的输出。输出末尾有一个--More--。如何增加缓冲区以显示完整输出?
以下是我的部分脚本:
SERVER_ssh = paramiko.SSHClient()
SERVER_ssh.load_system_host_keys()
SERVER_ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
SERVER_ssh.connect(hostname=SERVER_PLATFORM, port=SERVER_SSH_PORT, username=SERVER_ID, password=SERVER_PASSWORD)
except (AttributeError, TimeoutError) as err:
SERVER_ssh.close()
exit('Connection to SERVER fails')
with SSHClientInteraction(SERVER_ssh, timeout=20, display=True, buffer_size=8192) as interact:
interact.send(command)
time.sleep(2)
interact.expect(r'(.+)')
cmd_output_ssh = interact.current_output_clean
SERVER_ssh.close()
【问题讨论】:
-
你在运行什么命令?
标签: python python-3.x ssh terminal paramiko