0

I have a private key as

-----BEGIN OPENSSH PRIVATE KEY-----
...
-----END OPENSSH PRIVATE KEY-----

How to use this

import paramiko
ssh_client=paramiko.SSHClient()
key = paramiko.OPENSSHKey.from_private_key_file('/home/user/.ssh/id_rsa')
ssh_client.connect(hostname="xx.xx.xx.xx",username='user',pkey=key)

It says

AttributeError: module 'paramiko' has no attribute 'OPENSSHKey'

I tried

key = paramiko.RSAKey.from_private_key_file('/home/user/.ssh/id_rsa')

I get

paramiko.ssh_exception.SSHException: not a valid RSA private key file
Santhosh
  • 9,965
  • 20
  • 103
  • 243

0 Answers0