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.

ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.

See original GitHub issue

Dear Ktbyers,

I have a issue that tell me to pass the secret argument when i wan to telnet to catalyst 2900 series it’s stack switch, but i already pass the secret argument and then, i try to reopen my program and try to connect again and its work.

Error Message

  File "C:\Users\User\Python 3.5.3\lib\site-packages\netmiko\cisco_base_connection.py", line 17, in enable
    return super(CiscoBaseConnection, self).enable(cmd=cmd, pattern=pattern, re_flags=re_flags)
  File "C:\Users\User\Python 3.5.3\lib\site-packages\netmiko\base_connection.py", line 895, in enable
    raise ValueError(msg)
ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.

Code

# connect to device
net_connect = ConnectHandler(device_type=list.device_type, ip=list.ip, username=list.username,
                                                         password=list.password, secret=list.secret)
# enable mode
net_connect.enable()

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shabin75commented, Jun 10, 2020

It will work for me… when i give secret=“123”

device = ConnectHandler(device_type=“cisco_ios”, ip=“192.168.10.1”, username=“shabin”, password=“123”, global_delay_factor=2,secret=“123”)

1reaction
MikeJureckicommented, Dec 7, 2017

Personally in my code I use the same password for password and secret. If they are the same then try doing this.

net_connect = ConnectHandler(device_type=list.device_type, ip=list.ip, username=list.username,
                                                         password=list.password, secret=list.secret)

I personally do mine like this:

username = input('what is the username') # user enters username
password = input('What is the password') # user enters password
device = 'cisco_ios'
ipadd = '0.0.0.0' # I will also import from a list 

net_connect = netmiko.ConnectHandler(device_type=device, ip=ipadd, username=username, password=password, secret=password, port=22)

net_connect.enable()
Read more comments on GitHub >

github_iconTop Results From Across the Web

Netmiko - Enter configuration terminal mode - Stack Overflow
There is a configure terminal mode in netmiko , using conn.config_mode() sends configure terminal to the remote device. However, you can use ...
Read more >
How to use the netmiko.ssh_exception ... - Snyk
... msg = ( "Failed to enter enable mode. Please ensure you pass " "the 'secret' argument to ConnectHandler." ) raise ValueError(msg) return...
Read more >
netmiko.base_connection API documentation - GitHub Pages
Enter enable mode. :param cmd: Device command to enter enable mode. :param pattern: pattern to search for indicating device is waiting for password....
Read more >
Python ConnectHandler.enable Examples, netmiko ...
Python ConnectHandler.enable - 30 examples found. ... password=password, secret=enable_secret ) # enter enable mode ssh_connection.enable() # prepend the ...
Read more >
Netmiko – SCP IOS upload Error Troubleshooting! - ITalchemy
ValueError : Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.
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