我需要在pythonparamiko.client.SSHClient()
中运行echo命令,这样我可以导入任何库。我试过帕拉米哥。交通工具也不能用
创建SSHClient对象后,使用exec_command
方法向客户端发送命令,例如
client = paramiko.SSHClient()
... # set client object as needed and connect to SSHClient
command = "ls -l" # or echo
# execute command and handle output
stdin, stdout, stderr = client.exec_command(command)
print(stdout.read().decode("utf-8"))
print(f"status_code={stdout.channel.recv_exit_status()}")
print(stderr.read().decode("utf-8"))