How to type the credentials manually in Parallel-SSH or Paramiko

633 Views Asked by At

I am trying to create a script that will run commands over my 1000 Cisco devices. The device model is: Cisco Sx220 Series Switch Software, Version 1.1.4.1

The issue is that there is some kind of strange behavior for some of those Cisco devices.

When I am trying to login with regular SSH (PUTTY) with the correct credentials we are first getting 'Authentication Failure' and after 1 seconds I am getting the User Password Prompt again, typing the same credentials again is giving me a successful login.

The problem is that when I am trying to connect using my script (uses ParallelSSHClient), the connection drops after getting the authentication failure message and not able to enter the credentials again since it is getting the exception and terminal the program.

I am looking for a way to enter those credentials manual by connecting to the machine, getting the Authentication Failure message and ignoring it, recognizing that the current prompt has the User or Password appears on screen and then send it manually. I look for this kind of procedure anywhere but without any luck. Does ParallelSSHClient has this feature? If Paramiko has it, I am willing to move to Paramiko. Thanks :)

try:
        client = ParallelSSHClient(hosts=ip_list, user=user, password=password)

except Exception as err:
        print("There was an issue with connecting to the machine")

command_output = client.run_command(command)

Here is the accrual error that I am getting:

pssh.exceptions.AuthenticationException: ('Authentication error while connecting to %s:%s - %s', '172.31.255.10', 22, AuthenticationException('Password authentication failed',))
0

There are 0 best solutions below