Exception while ssh into IOS devices with public keys
See original GitHub issueReceived this exception “paramiko.transport:SSHException: Illegal info request from server” for the following code:
net_device = {
'device_type': 'cisco_ios',
'ip': '<REMOVED>',
'username': '<REMOVED>',
'use_keys': True,
'key_file': '<REMOVED>/.ssh/id_rsa',
'port': 22,
'allow_agent': True #regardless of value
}
import netmiko
import logging
logging.basicConfig(level=logging.NOTSET)
net_connect = netmiko.ConnectHandler(**net_device)
show_version = net_connect.send_command('show version')
print show_version
Same code works with JUNOS/NXOS but not with IOS devices.
DEBUG:paramiko.transport:userauth is OK ERROR:paramiko.transport:Exception: Illegal info request from server ERROR:paramiko.transport:Traceback (most recent call last): ERROR:paramiko.transport: File “<REMOVED>/cicd/venv/local/lib/python2.7/site-packages/paramiko/transport.py”, line 1791, in run ERROR:paramiko.transport: self.auth_handler._handler_table[ptype](self.auth_handler, m) ERROR:paramiko.transport: File “<REMOVED>/cicd/venv/local/lib/python2.7/site-packages/paramiko/auth_handler.py”, line 575, in _parse_userauth_info_request ERROR:paramiko.transport: raise SSHException(‘Illegal info request from server’) ERROR:paramiko.transport:SSHException: Illegal info request from server ERROR:paramiko.transport: DEBUG:paramiko.transport:Trying discovered key <REMOVED> in <REMOVED>/.ssh/id_rsa Traceback (most recent call last): File “con_pub.py”, line 17, in <module> net_connect = netmiko.ConnectHandler(**net_device) File “<REMOVED>cicd/venv/local/lib/python2.7/site-packages/netmiko/ssh_dispatcher.py”, line 96, in ConnectHandler return ConnectionClass(*args, **kwargs)
Python 2.7.3 cffi (1.9.1) cryptography (1.6) enum34 (1.1.6) idna (2.1) ipaddress (1.0.17) netmiko (1.1.0) paramiko (2.0.2) pip (9.0.1) pyasn1 (0.1.9) pycparser (2.17) PyYAML (3.12) scp (0.10.2) setuptools (29.0.1) six (1.10.0) wheel (0.29.0)
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (12 by maintainers)
Top GitHub Comments
@sjtarik I was able to get it working to a Cisco IOS device (Cisco 881) using the following:
What i read here has helped me resolved my issue.