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

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

Sam Brynes
Beginner
Beginner

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
Collaborator
Collaborator

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 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers