ubuntu 11.10 desktop: paramiko.SSHException: No existing session

Asked by wang yang

hi,

i am trying paramiko on my ubuntu 11.10 desktop. and it always failed with:

python ssh_test.py

*INFO* Logging into '10.56.117.82:22' as 'root'.
Traceback (most recent call last):
  File "ssh_test.py", line 22, in <module>
    main()
  File "ssh_test.py", line 14, in main
    ssh.login("root", "nokia123")
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/__init__.py", line 193, in login
    self._client.login(username, password)
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/pythonclient.py", line 46, in login
    self.client.connect(self.host, self.port, username, password)
  File "build/bdist.linux-i686/egg/paramiko/client.py", line 332, in connect
  File "build/bdist.linux-i686/egg/paramiko/client.py", line 493, in _auth

i have tried it, and find in transport module:
    def auth_password(self, username, password, event=None, fallback=True):
1152 if (not self.active) or (not self.initial_kex_done):
1153 # we should never try to send the password unless we're on a secure link
1154 raise SSHException('No existing session')

self.active is false. I haven't investigate more.
but if use "sudo python ssh_test.py" to run, it is ok.

my Ubuntu is use default user configuration(root has not configure password).
I don't know why must use root to run it?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu paramiko Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#1

Try it with sudo.

Revision history for this message
wang yang (wang-yang1980) said :
#2

I have tried 1.7.7.1, 1.7.4, 1.7.5 ..., they all have same problems:

Python 2.7.2+ (default, Oct 4 2011, 20:03:08)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>> paramiko.__version__
'1.7.7.1 (George)'
>>>

Revision history for this message
wang yang (wang-yang1980) said :
#3

yes, i know it. can use "sudo", but i want to know why.:)

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#4

You'd have to look at the script to see what it accesses

Revision history for this message
wang yang (wang-yang1980) said :
#5

pass debug info:
DEBUG:paramiko.transport:starting thread (client mode): 0xb714b02cL
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_4.3)
DEBUG:paramiko.transport:kex algos:['diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', '<email address hidden>'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', '<email address hidden>'] client mac:['hmac-md5', 'hmac-sha1', 'hmac-ripemd160', '<email address hidden>', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'hmac-ripemd160', '<email address hidden>', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', '<email address hidden>'] server compress:['none', '<email address hidden>'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
DEBUG:paramiko.transport:using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Adding ssh-rsa host key for 10.56.117.82: 36a9604e78384576455244088b688c0a
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (password) successful!
DEBUG:paramiko.transport:[chan 1] Max packet in: 34816 bytes
DEBUG:paramiko.transport:[chan 1] Max packet out: 32768 bytes
INFO:paramiko.transport:Secsh channel 1 opened.
DEBUG:paramiko.transport:[chan 1] Sesch channel 1 request ok
out: <paramiko.ChannelFile from <paramiko.Channel 1 (open) window=2097152 -> <paramiko.Transport at 0xb714b02cL (cipher aes128-ctr, 128 bits) (active; 1 open channel(s))>>>
err: <paramiko.ChannelFile from <paramiko.Channel 1 (open) window=2097152 -> <paramiko.Transport at 0xb714b02cL (cipher aes128-ctr, 128 bits) (active; 1 open channel(s))>>>
DEBUG:paramiko.transport:EOF in transport thread

failed debug info:
y136wang@y136wang-VirtualBox:~/work/Eclipse_workspace/python_test/src$ python test.py
DEBUG:paramiko.transport:starting thread (client mode): 0x919a1ccL
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_4.3)
DEBUG:paramiko.transport:kex algos:['diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', '<email address hidden>'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', '<email address hidden>'] client mac:['hmac-md5', 'hmac-sha1', 'hmac-ripemd160', '<email address hidden>', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'hmac-ripemd160', '<email address hidden>', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', '<email address hidden>'] server compress:['none', '<email address hidden>'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
DEBUG:paramiko.transport:using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Adding ssh-rsa host key for 10.56.117.82: 36a9604e78384576455244088b688c0a
DEBUG:paramiko.transport:Trying SSH agent key 94fb43f4fcab28b992cc3f07ecbd1484
DEBUG:paramiko.transport:userauth is OK
ERROR:paramiko.transport:Exception: key cannot be used for signing
ERROR:paramiko.transport:Traceback (most recent call last):
ERROR:paramiko.transport: File "build/bdist.linux-i686/egg/paramiko/transport.py", line 1559, in run
ERROR:paramiko.transport: self.auth_handler._handler_table[ptype](self.auth_handler, m)
ERROR:paramiko.transport: File "build/bdist.linux-i686/egg/paramiko/auth_handler.py", line 209, in _parse_service_accept
ERROR:paramiko.transport: sig = self.private_key.sign_ssh_data(self.transport.rng, blob)
ERROR:paramiko.transport: File "build/bdist.linux-i686/egg/paramiko/agent.py", line 152, in sign_ssh_data
ERROR:paramiko.transport: raise SSHException('key cannot be used for signing')
ERROR:paramiko.transport:SSHException: key cannot be used for signing
ERROR:paramiko.transport:
Traceback (most recent call last):
  File "test.py", line 19, in <module>
    main()
  File "test.py", line 8, in main
    ssh.connect("10.56.117.82", username="root", password="nokia123")
  File "build/bdist.linux-i686/egg/paramiko/client.py", line 332, in connect
  File "build/bdist.linux-i686/egg/paramiko/client.py", line 493, in _auth
paramiko.SSHException: No existing session

fix method:
ssh.connect(ip_addr, username=user, password=passwd, allow_agent=False, look_for_keys=False)

thank you very much!

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

Could report a bug or the issue to the author

Revision history for this message
wang yang (wang-yang1980) said :
#7

Thanks actionparsnip, that solved my question.