cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2589
Views
0
Helpful
1
Replies

How to use netconf ncclient to login with SSH key instead of username and password?

Sam Brynes
Level 1
Level 1

We have a Cisco CSR 1000V appliance in AWS that only has SSH key authentication enabled (we disabled logins using username / password). How can we use SSH keys with ncclient in python? I didn't see this in the documentation.

 

from ncclient import manager
m = manager.connect(host='host', username='username', password='password')

 

What is the equivalent for logging in with an SSH key?

1 Reply 1

omz
VIP Alumni
VIP Alumni

There is an open issue on GitHub .. you could try the suggestion. If that doesn't work .. I would suggest updating the issue on Github.

https://github.com/ncclient/ncclient/issues/192

from ncclient import manager

with manager.connect(host="<your hostname or IP>", device_params={'name': '<your device type if there is match>'}, 
key_filename="<path to your private key>", hostkey_verify = False):

    c = (m.get_config(source='running'))

 

hope this helps