Unable to agree on a pubkey algorithm for signing a 'ssh-rsa' key

39 views Asked by At

I am trying to connect to SFTP server to pull some datafiles using simple hostname, username and password to connect. I can connect through simple SFTP command but not with Paramiko in Python. But receive 'Unable to agree on pubkey algorithm'

Following is the traceback:

2024-03-11 19:59:24 Connected (version 2.0, client OpenSSH_7.4) 
2024-03-11 19:59:24 Exception (client): Unable to agree on a pubkey algorithm for signing a 'ssh-rsa' key! 
2024-03-11 19:59:24 Traceback (most recent call last): 
2024-03-11 19:59:24   File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/transport.py", line 2164, in run 
2024-03-11 19:59:24     handler(self.auth_handler, m) 
2024-03-11 19:59:24   File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/auth_handler.py", line 386, in _parse_service_accept 
2024-03-11 19:59:24     algorithm = self._finalize_pubkey_algorithm(key_type)
2024-03-11 19:59:24   File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/auth_handler.py", line 352, in _finalize_pubkey_algorithm
2024-03-11 19:59:24     raise AuthenticationException(err.format(key_type))
2024-03-11 19:59:24 paramiko.ssh_exception.AuthenticationException: Unable to agree on a pubkey algorithm for signing a 'ssh-rsa' key!
2024-03-11 19:59:25 ERROR - Traceback (most recent call last):
 File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/client.py", line 461, in connect
    passphrase,
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/client.py", line 781, in _auth
    raise saved_exception
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/client.py", line 757, in _auth
    self._transport.auth_publickey(username, key)
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/transport.py", line 1635, in auth_publickey
    return self.auth_handler.wait_for_response(my_event)
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/auth_handler.py", line 245, in wait_for_response
    raise e
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/transport.py", line 2164, in run
    handler(self.auth_handler, m)
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/auth_handler.py", line 386, in _parse_service_accept
    algorithm = self._finalize_pubkey_algorithm(key_type)
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/auth_handler.py", line 352, in _finalize_pubkey_algorithm
    raise AuthenticationException(err.format(key_type))
paramiko.ssh_exception.AuthenticationException: Unable to agree on a pubkey algorithm for signing a 'ssh-rsa' key!

I tried putting disabled_algorithms={'pubkeys': ['rsa-sha2-256', 'rsa-sha2-512']}) and look_for_key=False while connecting to SFTP server. But didn't help.

My current version is paramiko==2.12.0, I also tried downgrading the paramiko to 2.8.1 but that again gives me "Authentication Failed" error, as following:

2024-03-11 20:26:16 ERROR - Traceback (most recent call last):
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/client.py", line 446, in connect
    passphrase,
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/client.py", line 766, in _auth
    raise saved_exception
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/client.py", line 742, in _auth
    self._transport.auth_publickey(username, key)
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/transport.py", line 1580, in auth_publickey
    return self.auth_handler.wait_for_response(my_event)
  File "/opt/storeftp01_scripts/scriptenv/lib64/python3.6/site-packages/paramiko/auth_handler.py", line 250, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.

I am executing the code on Python 3.6.8 (default, Jan 11 2023, 08:43:50)  [GCC 8.5.0 20210514 (Red Hat 8.5.0-16)] on linux.

Please advise.

0

There are 0 answers