Python Forum
Paramiko SSH Session -> Authentification failed - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: Paramiko SSH Session -> Authentification failed (/thread-32740.html)



Paramiko SSH Session -> Authentification failed - werwurm01 - Mar-02-2021

Hello
i am new in Python and in this forum.
For my work i need an SSH Connection to an Ethernet NT from different Company. The Goal should be the automatically Configuration of this NT.
This Ethernet NT allows only SSH Connection via User/Password.
As SSH Client I prefer Paramiko. Following easy Code Snippet:
sh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, username, password)

if ssh.get_transport() is not None:
    print("Connected")
else:
    print("Not Connected")
This Connection works to connect to my linux Server. If I try to connect to this Ethernet NT, following Error Message appears:

Error:
paramiko.ssh_exception.AuthenticationException: Authentication failed.
User and Password are correct.

I receive following debug from Paramiko:
DEB [20210228-17:56:23.861] thr=1   paramiko.transport: starting thread (client mode): 0xd0beb2e0
DEB [20210228-17:56:23.861] thr=1   paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.7.2
DEB [20210228-17:56:23.881] thr=1   paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_7.4
INF [20210228-17:56:23.881] thr=1   paramiko.transport: Connected (version 2.0, client OpenSSH_7.4)
DEB [20210228-17:56:23.884] thr=1   paramiko.transport: kex algos:['curve25519-sha256', '[email protected]', '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', 'diffie-hellman-group14-sha1'] server key:['ssh-rsa', 'rsa-sha2-512', 'rsa-sha2-256'] client encrypt:['[email protected]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', '[email protected]', '[email protected]'] server encrypt:['[email protected]', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', '[email protected]', '[email protected]'] client mac:['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', '[email protected]'] server compress:['none', '[email protected]'] client lang:[''] server lang:[''] kex follows?False
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: Kex agreed: [email protected]
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: HostKey agreed: ssh-rsa
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: Cipher agreed: aes128-ctr
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: MAC agreed: hmac-sha2-256
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: Compression agreed: none
DEB [20210228-17:56:23.970] thr=1   paramiko.transport: kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEB [20210228-17:56:23.971] thr=1   paramiko.transport: Switch to new keys ...
DEB [20210228-17:56:23.973] thr=2   paramiko.transport: Adding ssh-rsa host key for 192.168.0.200: b'f2aa0b52eaf68face2c79cd56ffe880e'
DEB [20210228-17:56:23.976] thr=1   paramiko.transport: userauth is OK
INF [20210228-17:56:23.986] thr=1   paramiko.transport: Authentication (password) failed.
DEB [20210228-17:56:23.996] thr=1   paramiko.transport: EOF in transport thread
Tried this via PuTTY und commandline. Also here the password is not working automatically. The Passwort request is shown.
I am wondering if there is any special SSH implementation.

Is it possible to send the password as input in an inactive SSH Connection over Paramiko.
Have anyone any Ideas to login in the Device Wall

Best Regards,
Marcus