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

Cant access SG200 and CBS switches using netmiko python scripts #3281

Closed
Jayze611 opened this issue Aug 31, 2023 · 4 comments
Closed

Cant access SG200 and CBS switches using netmiko python scripts #3281

Jayze611 opened this issue Aug 31, 2023 · 4 comments

Comments

@Jayze611
Copy link

Jayze611 commented Aug 31, 2023

Hi Anyone

We are trying to log in to SG250-26HP, SG200-18, SF220-24 24, SG250-26 26, CBS350-24FP Switches using Netmiko python scripts to configure switches.

Unfortunately not as routers they have Login as: and username both when SSH.
We tried few different ways but failed

Sample as follow

from netmiko import Netmiko
from getpass import getpass

cisco_sw = {
"host": "", # input("Host: "),
"username": "admin", # input("Username: "),
"password": "", # getpass(),
"device_type": "cisco_s200"
}

connection = Netmiko(**cisco_sw)
prompt = connection.find_prompt()
print(prompt)

output = connection.send_command("show vlan")
print(output)

connection.disconnect()

But we are getting an error each time we try , tried this in all different models
is there a way around it to SSH in to these switches using netmiko

@ktbyers
Copy link
Owner

ktbyers commented Aug 31, 2023

@Jayze611 If you manually SSH to one of these devices, can you show what the SSH login process looks like (obviously, you can hide anything that is confidential to your environment).

@Jayze611
Copy link
Author

Jayze611 commented Aug 31, 2023

image

@Jayze611
Copy link
Author

Before the username and the password when we SSH to the switch, it prompt 'Login as':
Which can be anything
This is where we think that it blocks us accessing.

@ktbyers
Copy link
Owner

ktbyers commented Sep 1, 2023

Maybe look at the session_log or the Python debugger and see where it is getting to.

The driver does have the login as and the User Name/Password handling coded in. Your banner might cause problems, but try looking at session_log and/or the debugger to see where it is hanging up at.

@ktbyers ktbyers closed this as completed Jan 12, 2024
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

2 participants