HI Nilamo,
Thanks for sticking with me.
I am moving forward, but not quite there yet.
Sorry,
the code i used below is
Thanks for sticking with me.
I am moving forward, but not quite there yet.
C:\Users\Comp1\Documents\Work\Old>Host_FingerPrint_SFTP.py Yay.txt Traceback (most recent call last): File "C:\Users\Comp1\Documents\Work\Old\Host_FingerPrint_SFTP.py", line 17, in <module> key = paramiko.ed25519key.Ed25519Key(data=text.encode()) File "C:\Users\Comp1\AppData\Local\Programs\Python\Python37-32\lib\site-p ackages\paramiko\ed25519key.py", line 71, in __init__ cert_type="[email protected]", File "C:\Users\Comp1\AppData\Local\Programs\Python\Python37-32\lib\site-p ackages\paramiko\pkey.py", line 416, in _check_type_and_load_cert raise SSHException(err.format(self.__class__.__name__, type_)) paramiko.ssh_exception.SSHException: Invalid key (class: Ed25519Key, data type: 5db5b8556c55d47aa661ea39b4b794e823a6f82066da73c4761243fe21daThis makes me think that the key i copied from File Zilla is wrong (either i copied it wrong which i have checked) or (else it is not the real key...?)
Sorry,
the code i used below is
import pysftp import sys import paramiko from paramiko.py3compat import decodebytes import base64 path = './folder/' + sys.argv[1] #hard-coded localpath = sys.argv[1] remote_path = "./work/" #hard-coded host = "1.2.3.4" #hard-coded password = "password" #hard-coded username = "username" #hard-coded keydata = b"""RLhdtbhVbFXUeqZh6jm0t5ToI6b4IGbac8R2EkP+Ido=""" #obtained using filezilla, connected successfully then used lock icon on the bottom right to display fingerprints: SHA256: RLh...kP+Ido= text = base64.b64decode(keydata).hex() key = paramiko.ed25519key.Ed25519Key(data=text.encode()) cnopts = pysftp.CnOpts() cnopts.hostkeys.add('1.2.3.4', 'ssh-ed25519', key) with pysftp.Connection(host, username=username, password=password, cnopts=cnopts) as sftp: sftp.put(localpath, path) print("Upload done")