因为paramiko循环永远在等待用户输入命令。我不能杀人,也不能做任何事情来继续。在stdin, stdout, stderr = self.connection.exec_command(command)
while not stdout.channel.exit_status_ready():
if stdout.channel.recv_ready():
alldata = stdout.channel.recv(1024)
rl, wl, xl = select.select([stdout.channel], [], [], 0.0)
if len(rl) > 0:
self.logger.info(stdout.channel.recv(1024), )
在这种方法下,我尝试使用paramiko登录到其他用户(root)并杀死这个remoteuser。在
根:
^{pr2}$
我尝试使用线程,但由于它无法处理。它无法执行下一个线程。在thread1 = threading.Thread(target=remoteuser_stuckfreeze)
thread2 = threading.Thread(target=roottokillremoteuser)
thread1.start()
thread2.start()
thread1.join()
thread2.join()
谢谢。在