La session SSH existante renvoie paramiko.ssh_exception.SSHException : aucune session existante après la mise à niveau de Windows
J'ai un comportement bizarre avec paramiko
Voici mon code:
con = paramiko.SSHClient()
con.load_system_host_keys()
con.set_missing_host_key_policy(paramiko.AutoAddPolicy())
con.connect(ip_address, port=port, username=user, password=password, timeout=30)
Cela fonctionne bien depuis des mois maintenant, cependant, après avoir effectué une mise à niveau de Windows pour ma machine distante (la machine à laquelle je me connecte), je reçois l'exception
paramiko.ssh_exception.SSHException: No existing session
J'ai vu d'autres threads SO et j'ai essayé de faire la même chose après la mise à niveau de Windows, mais avec
con.connect(ip_address, port=port, username=user, password=password, timeout=30, allow_agent=False, look_for_keys=False)
Chaque fois que je fais ça, je reçois en retourparamiko.ssh_exception.AuthenticationException: Authentication failed.
journal paramiko + traceback :
regular traceback
paramiko.transport transport.py:1873 starting thread (client mode): 0x49455610
paramiko.transport transport.py:1873 Local version/idstring: SSH-2.0-paramiko_2.10.3
paramiko.transport transport.py:1873 Remote version/idstring: SSH-2.0-OpenSSH_for_Windows_8.6
paramiko.transport transport.py:1873 Connected (version 2.0, client OpenSSH_for_Windows_8.6)
paramiko.transport transport.py:1873 === Key exchange possibilities ===
paramiko.transport transport.py:1873 kex algos: curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256
paramiko.transport transport.py:1873 server key: rsa-sha2-512, rsa-sha2-256, ssh-rsa, ecdsa-sha2-nistp256, ssh-ed25519
paramiko.transport transport.py:1873 client encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com
paramiko.transport transport.py:1873 server encrypt: chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com
paramiko.transport transport.py:1873 client mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1
paramiko.transport transport.py:1873 server mac: umac-64-etm@openssh.com, umac-128-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, umac-128@openssh.com, hmac-sha2-256, hmac-sha2-512, hmac-sha1
paramiko.transport transport.py:1873 client compress: none, zlib@openssh.com
paramiko.transport transport.py:1873 server compress: none, zlib@openssh.com
paramiko.transport transport.py:1873 client lang: <none>
paramiko.transport transport.py:1873 server lang: <none>
paramiko.transport transport.py:1873 kex follows: False
paramiko.transport transport.py:1873 === Key exchange agreements ===
paramiko.transport transport.py:1873 Kex: curve25519-sha256@libssh.org
paramiko.transport transport.py:1873 HostKey: ssh-ed25519
paramiko.transport transport.py:1873 Cipher: aes128-ctr
paramiko.transport transport.py:1873 MAC: hmac-sha2-256
paramiko.transport transport.py:1873 Compression: none
paramiko.transport transport.py:1873 === End of kex handshake ===
paramiko.transport transport.py:1873 kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
paramiko.transport transport.py:1873 Switch to new keys...
paramiko.transport transport.py:1873 Adding ssh-ed25519 host key for ip_adress: b'bla' #edited
paramiko.transport transport.py:1873 Got EXT_INFO: {'server-sig-algs': b'ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com'}
paramiko.transport transport.py:1873 Trying discovered key b'bla' in C:\Users\user/.ssh/id_rsa #edited
paramiko.transport transport.py:1873 userauth is OK
paramiko.transport transport.py:1873 Finalizing pubkey algorithm for key of type 'ssh-rsa'
paramiko.transport transport.py:1873 Our pubkey algorithm list: ['rsa-sha2-512', 'rsa-sha2-256', 'ssh-rsa']
paramiko.transport transport.py:1873 Server-side algorithm list: ['ssh-ed25519', 'sk-ssh-ed25519@openssh.com', 'ssh-rsa', 'rsa-sha2-256', 'rsa-sha2-512', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'sk-ecdsa-sha2-nistp256@openssh.com', 'webauthn-sk-ecdsa-sha2-nistp256@openssh.com']
paramiko.transport transport.py:1873 Agreed upon 'rsa-sha2-512' pubkey algorithm
paramiko.transport transport.py:1873 EOF in transport thread
File "C:\projects\automation\windowsapi\scp_client.py", line 17, in __init__
self.__ssh_client.connect(ip_address, port=port, username=user, password=password, timeout=30)
File "C:\Users\user\.virtualenvs\automation-_iNAktOj\lib\site-packages\paramiko\client.py", line 435, in connect
self._auth(
File "C:\Users\user\.virtualenvs\automation-_iNAktOj\lib\site-packages\paramiko\client.py", line 766, in _auth
raise saved_exception
File "C:\Users\user\.virtualenvs\automation-_iNAktOj\lib\site-packages\paramiko\client.py", line 753, in _auth
self._transport.auth_password(username, password)
File "C:\Users\user\.virtualenvs\automation-_iNAktOj\lib\site-packages\paramiko\transport.py", line 1552, in auth_password
raise SSHException("No existing session")
paramiko.ssh_exception.SSHException: No existing session
et connectez-vous avecdisabled_algorithms=dict(pubkeys=['rsa-sha2-256', 'rsa-sha2-512'])
transport.py:1873 kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
transport.py:1873 Switch to new keys...
transport.py:1873 Got EXT_INFO: {'server-sig-algs': b'ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com'}
transport.py:1873 Trying discovered key b'0b11111111' in C:\Users\user/.ssh/id_rsa # edited
transport.py:1873 userauth is OK
transport.py:1873 Finalizing pubkey algorithm for key of type 'ssh-rsa'
transport.py:1873 Our pubkey algorithm list: ['ssh-rsa']
transport.py:1873 Server-side algorithm list: ['ssh-ed25519', 'sk-ssh-ed25519@openssh.com', 'ssh-rsa', 'rsa-sha2-256', 'rsa-sha2-512', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'sk-ecdsa-sha2-nistp256@openssh.com', 'webauthn-sk-ecdsa-sha2-nistp256@openssh.com']
transport.py:1873 Agreed upon 'ssh-rsa' pubkey algorithm
transport.py:1873 EOF in transport thread
Solution du problème
J'ai trouvé le problème, j'ai 2 comptes sur la machine, Administrator
et un utilisateur personnalisé que nous créons lors de la création de la machine
Une fois la mise à niveau du système d'exploitation terminée, Windows décide de désactiver l'utilisateur avec lequel j'utilisais SCP
Commentaires
Enregistrer un commentaire