You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Authenthication failed with key authentication in paramiko 2.9+ #2143
I've created a ssh key pair via ssh-keygen -f bla -C "" and I'm able to log into the customers sftp server via the command line.
Unfortunately it is not possible to use the same private key to log into the server via paramiko unless I use Paramiko 2.8.1. I've used 2.12.0 before. Interesting is that I was able to establish a ssh connection via paramiko 2.12.0 to a sftp server run via the SFTP Docker image by atmoz.
I was having this exact same problem, here is why it works in paramiko 2.8.1 but not paramiko 2.9.0. This is because your ssh key is a RSA key using the SHA1 signature. This is otherwise known as "ssh-rsa". Comparing the diff between those two tags in the repo (scroll down to the paramiko/transport.py file on line 180 and 181 - and similarly on line 191 and 192), you'll see that in version 2.9.0, "rsa-sha2-512" and "rsa-sha2-256" were added before "ssh-rsa".
This means it will try to use one of these new algorithms first in the new version. A simple fix is to pass the algorithms that you do not want to use in the disabled_algorithms parameter. For example,
Another option is to configure the transport for the server via e.g. transport.server_extensions = {'server-sig-algs': 'ssh-rsa'} . Worked for paramiko version 2.12.0
Once I added disabled_algorithms={"pubkeys": ["rsa-sha2-256", "rsa-sha2-512"]}, it worked once again, but why are the algorithms a list if it will never get to the algorithm that actually works? I don't think I understand the root cause here. Is there something else going on here? is the issue here how the key was generated?
I am struggling with this same type ssh issue.. when i add the code disabled_algorithms={"pubkeys": ["rsa-sha2-256", "rsa-sha2-512"]} I then get
Exception: (<class 'TypeError'>, TypeError("'NoneType' object does not support the context manager protocol"), <traceback object at 0x0315D9A8>)
the key_path is pointing to a PEM file
thoughts?
All is working fine on this server using ppk file and filezilla.. and the code works fine on our original server, but the new one has a newer version of paramiko. So I added the disabled_algorithims code
Activity
nyoungstudios commentedon Dec 9, 2022
I was having this exact same problem, here is why it works in
paramiko 2.8.1but notparamiko 2.9.0. This is because your ssh key is a RSA key using the SHA1 signature. This is otherwise known as "ssh-rsa". Comparing the diff between those two tags in the repo (scroll down to theparamiko/transport.pyfile on line 180 and 181 - and similarly on line 191 and 192), you'll see that in version 2.9.0, "rsa-sha2-512" and "rsa-sha2-256" were added before "ssh-rsa".This means it will try to use one of these new algorithms first in the new version. A simple fix is to pass the algorithms that you do not want to use in the
disabled_algorithmsparameter. For example,vmoravec commentedon Dec 14, 2022
Another option is to configure the transport for the server via e.g.
transport.server_extensions = {'server-sig-algs': 'ssh-rsa'}. Worked forparamikoversion2.12.0avatarofhope2 commentedon Jan 12, 2023
I ran into this problem with 2.12.0
Once I added
disabled_algorithms={"pubkeys": ["rsa-sha2-256", "rsa-sha2-512"]}, it worked once again, but why are the algorithms a list if it will never get to the algorithm that actually works? I don't think I understand the root cause here. Is there something else going on here? is the issue here how the key was generated?upperdeck commentedon Feb 27, 2023
I am struggling with this same type ssh issue.. when i add the code disabled_algorithms={"pubkeys": ["rsa-sha2-256", "rsa-sha2-512"]} I then get
Exception: (<class 'TypeError'>, TypeError("'NoneType' object does not support the context manager protocol"), <traceback object at 0x0315D9A8>)
the key_path is pointing to a PEM file
thoughts?
All is working fine on this server using ppk file and filezilla.. and the code works fine on our original server, but the new one has a newer version of paramiko. So I added the disabled_algorithims code
code is
ssh.connect(hostname = 'xxx.xx.xxx.xxx',
port=22,
username="username",
key_filename=key_path,
password = pwd,
disabled_algorithms={"pubkeys": ["rsa-sha2-256", "rsa-sha2-512"]})
bskinn commentedon Feb 28, 2023
Marking this as likely relevant to the key/auth overhaul of #387.
Take paramiko 2.9.+ breaking changes into account
Take paramiko 2.9.+ breaking changes into account
Take paramiko 2.9.+ breaking changes into account
Take paramiko 2.9.+ breaking changes into account