Long-running ssh commands in python paramiko module (and how to end them)
问题 I want to run a tail -f logfile command on a remote machine using python's paramiko module. I've been attempting it so far in the following fashion: interface = paramiko.SSHClient() #snip the connection setup portion stdin, stdout, stderr = interface.exec_command("tail -f logfile") #snip into threaded loop print stdout.readline() I'd like the command to run as long as necessary, but I have 2 problems: How do I stop this cleanly? I thought of making a Channel and then using the shutdown()