cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

1216
Views
0
Helpful
1
Replies
Sam Brynes
Beginner

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

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 

Create
Recognize Your Peers
Content for Community-Ad