question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Netmiko NetMikoAuthenticationException timeout

See original GitHub issue

Hello. I have a simple example :

from netmiko import ConnectHandler
from netmiko.ssh_exception import NetMikoAuthenticationException, NetMikoTimeoutException

CONNECTION_PARAMS = {'ip': 'cloud-myt-qrator-6s254.yndx.net', 'username': 'netinfra-mon', 'timeout': 10, 'use_keys': True, 'key_file': '/home/netinfra-mon/.ssh/id_rsa', 'device_type': 'juniper'}

try:
    with ConnectHandler(**CONNECTION_PARAMS) as ssh:
        result = ssh.send_command('sh ver')
        print(result)
except (NetMikoAuthenticationException, NetMikoTimeoutException):
    print('Failed to connect to {}'.format(CONNECTION_PARAMS['ip']))

I can change connection timeout(NetMikoTimeoutException) with timeout parameter but it doesn’t effect NetMikoAuthenticationException.

SSH on this device is enabled but there is no such user so NetMikoAuthenticationException is in place. As I can see it is 60 seconds by default:

time ./bla.py
Failed to connect to cloud-myt-qrator-6s254.yndx.net

real    1m0.413s
user    0m0.296s
sys     0m0.024s

And I can’t find if there is a parameter to change failed auth timeout.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
TomCoscommented, Aug 23, 2018

Yes correct, slow to authenticate for a number of reasons (distance, inefficient routing, bad firmware, etc)

0reactions
carlmontanaricommented, May 24, 2019

Closing since this has been merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use the netmiko.ssh_exception ... - Snyk
NetmikoAuthenticationException function in netmiko ... self.paramiko_cleanup() msg = "Connection to device timed-out: {device_type} {ip}:{port}".format( ...
Read more >
netmiko API documentation - GitHub Pages
:param banner_timeout: Set a timeout to wait for the SSH banner (pass to Paramiko) ... Authentication failure will generate a NetmikoAuthenticationException.
Read more >
Developers - Netmiko NetMikoAuthenticationException timeout -
Hello. I have a simple example : from netmiko import ConnectHandler from netmiko.ssh_exception import NetMikoAuthenticationException, ...
Read more >
Netmiko4: ConnLogOnly - Python for Network Engineers
One pattern that Netmiko users frequently implement is a series of ... ConnectHandler(**device) except NetmikoAuthenticationException: # do ...
Read more >
Netmiko is not finding the prompt when entering banner exec ...
timeout ) File "C:\Users\user\PycharmProjects\untitled\venv\lib\site-packages\paramiko\buffered_pipe.py", line 164, in read raise PipeTimeout() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found