Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH into a device that has a Login then Username Password #3385

Open
vtdawson30344 opened this issue Feb 20, 2024 · 0 comments
Open

SSH into a device that has a Login then Username Password #3385

vtdawson30344 opened this issue Feb 20, 2024 · 0 comments

Comments

@vtdawson30344
Copy link

I am trying to use Netmiko to access a StarTech Switch. My issue is that when you SSH into the switch you get a

LOGIN AS: prompt. you can enter anything here
then I get a USERNAME: prompt and a Password Prompt

####My Code
from netmiko.ssh_autodetect import SSHDetect
from netmiko.ssh_dispatcher import ConnectHandler
remote_device = {'device_type': 'autodetect',
'host': 'MyHost',
'username': 'USER1',
'password': 'Password1'}
guesser = SSHDetect(**remote_device)
best_match = guesser.autodetect()
print(best_match)

####Error message:

Traceback (most recent call last):
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\netmiko\base_connection.py", line 1046, in establish_connection
self.remote_conn_pre.connect(**ssh_connect_params)
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\paramiko\client.py", line 459, in connect
self._auth(
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\paramiko\client.py", line 790, in _auth
raise saved_exception
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\paramiko\client.py", line 777, in _auth
self._transport.auth_password(username, password)
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\paramiko\transport.py", line 1569, in auth_password
return self.auth_handler.wait_for_response(my_event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\paramiko\auth_handler.py", line 259, in wait_for_response
raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\vdawson\OneDrive - Metropolitan Atlanta Rapid Transit Authority\Projects\ISE\AudoDetect.py", line 7, in
guesser = SSHDetect(**remote_device)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\netmiko\ssh_autodetect.py", line 314, in init
self.connection = ConnectHandler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\netmiko\ssh_dispatcher.py", line 365, in ConnectHandler
return ConnectionClass(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\netmiko\base_connection.py", line 439, in init
self._open()
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\netmiko\base_connection.py", line 444, in _open
self.establish_connection()
File "C:\Users\vdawson\AppData\Local\Programs\Python\Python311\Lib\site-packages\netmiko\base_connection.py", line 1083, in establish_connection
raise NetmikoAuthenticationException(msg)
netmiko.exceptions.NetmikoAuthenticationException: Authentication to device failed.

Common causes of this problem are:

  1. Invalid username and password
  2. Incorrect SSH-key file
  3. Connecting to the wrong device

Device settings: autodetect 10.XXX..XXX.XXX

Authentication failed.
================ READY ================

Please let me know if you need more information
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant