I have just been trying ssh connection with paramiko
.
Everything looks fine, but in the final step, when calling the close()
method to disconnect the client.
Here is my script:
#!/usr/bin/python
import paramiko
import os
ssh = paramiko.SSHClient()
private_key = os.path.expanduser('~/.ssh/id_dsa')
mkey = paramiko.DSSKey.from_private_key_file(private_key,password='JacquiKoala')
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('monitor', username='probert', pkey = mkey)
stdin, stdout, stderr = ssh.exec_command('whoami')
print stdout.readlines()
ssh.close
The shell just hangs, I can type stuff, without any result, Ctrl+C or Ctrl+D don't stop the script nor the connection. I have no other way except closing the shell window which is kind of dirty.
I am running Ubuntu 10.10 with python 2.6.6
and paramiko-1.7.4
compiled from sources.
I really don't know what happens; the close()
method is correctly executed as a print "blah" after is executed as well, no error message, and still connected without an appropriate way to stop it.
Thanks for helping me :)
Cheers;
Philippe