Repository navigation
Description
Are you using paramiko as a client or server?
Client
What feature(s) aren't working right?
SSH, Keys/auth
What version(s) of paramiko are you using?
2.10.5
What version(s) of Python are you using?
3.9.11
What operating system and version are you using?
windows 2012 R2
If you're connecting as a client, which SSH server are you connecting to?
No response
If you're using paramiko as part of another tool, which tool/version?
No response
Expected/desired behavior
This problem occasionally occurs when the Linux device is connected for multiple times. However, the connection can be successfully performed using PuTTY.
import paramiko
client = paramiko.SSHClient()
client.connect('ip', username='username', password='password', timeout=60,
auth_timeout=60, banner_timeout=60, port=22,
allow_agent=False, look_for_keys=False)
client.close()
Actual behavior
[2023-10-19 09:04:35,830] [ERROR] [stack_exception_info: Traceback (most recent call last):
File "D:\23.10.17\smartIDC\lib\framework\shell_manager\ssh.py", line 441, in connect_verification
client.connect(self.ip,
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\client.py", line 435, in connect
self._auth(
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\client.py", line 766, in _auth
raise saved_exception
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\client.py", line 753, in _auth
self._transport.auth_password(username, password)
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\transport.py", line 1571, in auth_password
return self.auth_handler.wait_for_response(my_event)
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\auth_handler.py", line 245, in wait_for_response
raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.
[2023-10-19 09:04:35,837] [ERROR] [stack_exception_info: Traceback (most recent call last):
File "D:\23.10.17\smartIDC\lib\framework\shell_manager\ssh.py", line 441, in connect_verification
client.connect(self.ip,
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\client.py", line 435, in connect
self._auth(
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\client.py", line 766, in _auth
raise saved_exception
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\client.py", line 753, in _auth
self._transport.auth_password(username, password)
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\transport.py", line 1571, in auth_password
return self.auth_handler.wait_for_response(my_event)
File "D:\23.10.17\smartIDC\python39\lib\site-packages\paramiko\auth_handler.py", line 245, in wait_for_response
raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.
How to reproduce
No response
Anything else?
No response
Activity
bskinn commentedon Oct 19, 2023
Hi, @Xiayongkui -- please reformat your code and output/tracebacks using code blocks. Without that formatting it's very hard to read.
Thank you!