[paramiko] bad file descriptor

David Mason paramiko at gptech.com.au
Wed Nov 22 22:36:55 PST 2006


Hi list,

I've been getting an error when using SFTPClient from an SSHClient 
object, and then closing these objects.

Here is a sample run through the interactive shell including DEBUG level 
logging...

Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import logging
 >>> from paramiko import AutoAddPolicy, SSHClient
 >>> logging.basicConfig(level=logging.DEBUG)
 >>> ssh = SSHClient()
 >>> ssh.set_missing_host_key_policy(AutoAddPolicy())
 >>> ssh.connect('192.168.0.1', username='username', 
key_filename='private.key')
DEBUG:paramiko.transport:starting thread (client mode): 0xB7DE76ECL
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_4.2p1)
DEBUG:paramiko.transport:kex 
algos:['diffie-hellman-group-exchange-sha1', 
'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server 
key:['ssh-dss'] client encrypt:['aes128-cbc', '3des-cbc', 
'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 
'aes192-cbc', 'aes256-cbc', 'rijndael-cbc at lysator.liu.se', 'aes128-ctr', 
'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', '3des-cbc', 
'blowfish-cbc', 'cast128-cbc', 'arcfour128', 'arcfour256', 'arcfour', 
'aes192-cbc', 'aes256-cbc', 'rijndael-cbc at lysator.liu.se', 'aes128-ctr', 
'aes192-ctr', 'aes256-ctr'] client mac:['hmac-md5', 'hmac-sha1', 
'hmac-ripemd160', 'hmac-ripemd160 at openssh.com', 'hmac-sha1-96', 
'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'hmac-ripemd160', 
'hmac-ripemd160 at openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] client 
compress:['none', 'zlib at openssh.com'] server compress:['none', 
'zlib at openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Ciphers agreed: local=aes128-cbc, remote=aes128-cbc
DEBUG:paramiko.transport:using kex diffie-hellman-group1-sha1; server 
key type ssh-dss; cipher: local aes128-cbc, remote aes128-cbc; mac: 
local hmac-sha1, remote hmac-sha1; compression: local none, remote none
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Adding ssh-dss host key for 192.168.0.1: 
df5ef7d8e83ca84522f27cb2836f4491
DEBUG:paramiko.transport:Trying key 1d164cbb9627aa786714ab1d003d0bfe 
from private.key
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (publickey) successful!
 >>> sftp = ssh.open_sftp()
DEBUG:paramiko.transport.1:Max packet in: 34816 bytes
DEBUG:paramiko.transport.1:Max packet out: 32768 bytes
INFO:paramiko.transport:Secsh channel 1 opened.
DEBUG:paramiko.transport.1:Sesch channel 1 request ok
INFO:paramiko.transport.1.sftp:Opened sftp connection (server version 3)
 >>> sftp.close()
INFO:paramiko.transport.1.sftp:sftp session closed.
DEBUG:paramiko.transport.1:EOF sent
 >>> sftp = None
 >>> ssh.close()
ERROR:paramiko.transport:Socket exception: Bad file descriptor (9)
 >>> ssh = None
 >>>

There is an ERROR on the ssh.close() line "Bad file descriptor (9)".  Is 
this a bug that I've hit, or am I not using the library correctly?

I'm using paramiko version 1.6.4, on Ubuntu dapper.

Cheers,
David Mason



More information about the paramiko mailing list