0

I'm trying to connect to sftp server using pysftp.

import pysftp

cnopts = pysftp.CnOpts()
cnopts.hostkeys = config.hostKeys

key = '/path/private-key.ppk'
passphrase = '123456'
sftp = pysftp.Connection(
       host=host, username=userName,
       cnopts=cnopts, private_key=key, private_key_pass=passphrase)

And it returns me the error - not a valid RSA private key file.

Using .ssh file instead of .ppk file allows me to connect,

but it won't be possible to manually convert the files each time.

Any solution where I can use the .ppk directly for connection?

Gary
  • 31
  • 1
  • 6

0 Answers0