pysftp Host keys not found AWS PEM lightsail
If your using pysftp and your getting "host keys not found" error when
trying to connect to instance, try the following:
(note: the following assumes you have openSSH installed. Windows users will
need to
manually install
this)
2. Run :
chmod 400 keyfile.pem
3. Use OpenSSH to ssh into your instance:
ssh -i "keyfile.pem" USERNAME@IP_OF_INSTANCE
And that's it! Your python script should work :)
Example python script:
import pysftp
sftp = pysftp.Connection(host="INSTANCE_IP", username="USERNAME", private_key=r"../file.pem")
See my full answer on stackoverflow for explanation : https://stackoverflow.com/questions/62328536/sftp-to-aws-lightsail-python-using-pysftp-key-error/62532139#62532139
SNAPPED!

SNAPPED!
Comments
Post a Comment