我有以下有效的代码,但我想与机器手动交互
import paramiko
import sys
import subprocess
#
# we instantiate a new object referencing paramiko's SSHClient class
#
vm=paramiko.SSHClient()
vm.set_missing_host_key_policy(paramiko.AutoAddPolicy())
vm.connect('seapr1bast',username='razvang')
#
vmtransport = vm.get_transport()
dest_addr = ('10.0.0.2', 22) #edited#
local_addr = ('10.0.0.1', 22) #edited#
vmchannel = vmtransport.open_channel("direct-tcpip", dest_addr, local_addr)
#
jhost=paramiko.SSHClient()
jhost.set_missing_host_key_policy(paramiko.AutoAddPolicy())
#jhost.load_host_keys('/home/osmanl/.ssh/known_hosts') #disabled#
jhost.connect('10.0.0.2', username='user', password='', sock=vmchannel)
#
stdin, stdout, stderr = jhost.exec_command("hostname;whoami") #edited#
#
print stdout.read() #edited#
#
jhost.close()
vm.close()
你们中有些人写过这样的东西吗?