I have aws ssh key as awskey.pem. I am trying to sftp to the host with pysftp.
import pysftp as sftp
keyfile='c:\\awskey.pem'
Cnopts=sftp.CnOpts()
Cnopts.hostkeys.load(keyfile)
srv=sftp.connection(host ='xx.xx.xx.xx',cnopts=Cnopts)
lpath='c:\\test.txt'
rpath='test.txt'
srv.put(lpath,rpath)
srv.close()
there seems to be a problem reading the pem file
as i get the error
'pysftp.exceptions.HostKeysException: Host keys not found'
In searching other sites there is no discussion on
the format of a key file.
Not sure if it is supposed to be a .pem
format or I have to convert it to some other format.
After spending 2 days on this I am no further ahead.
keyfile='c:\\awskey.pem'
srv=sftp.connection(host ='xx.xx.xx.xx',username='user',private_key=keyfile)
and now i get error
pysftp.exceptions.HostKeysException: No Host Keys Found
Must be missing something somewhere.
This is on Windows 10 so no .ssh/known_hosts file.
Do I need to retrieve the host key ?
or switch back to pysftp 0.2.8 as suggested elsewhere?