Verify host key with pysftp

前端 未结 9 984
北海茫月
北海茫月 2020-11-22 08:33

I am writing a program using pysftp, and it wants to verify the SSH host Key against C:\\Users\\JohnCalvin\\.ssh\\known_hosts.

Using PuTTY, the terminal

9条回答
  •  一向
    一向 (楼主)
    2020-11-22 08:54

    If You try to connect by pysftp to "normal" FTP You have to set hostkey to None.

    import pysftp
    
    cnopts = pysftp.CnOpts()
    cnopts.hostkeys = None 
    with pysftp.Connection(host='****',username='****',password='***',port=22,cnopts=cnopts) as sftp:
        print('DO SOMETHING')
    

提交回复
热议问题