【发布时间】:2019-05-20 17:08:54
【问题描述】:
所以我在通过 SFTP 连接到远程服务器时遇到了很多问题。我已经尝试了如下的正常方式。
sftp = pysftp.Connection(host='Host',username='username',password='passwd',private_key=".ppk")
这不起作用。我收到以下错误:
SSHException: No hostkey for host ***** found.
然后我尝试了以下方法:
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
s = pysftp.Connection(host='host', username='user', password='password', cnopts=cnopts)
这也不起作用。我收到以下错误:
BadAuthenticationType: ('Bad authentication type', ['publickey']) (allowed_types=['publickey'])
当我运行以下命令时:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect("host",username = "username",password = "password")
ssh_session = client.get_transport().open_session()
我得到同样的错误:
BadAuthenticationType: ('Bad authentication type', ['publickey']) (allowed_types=['publickey'])
【问题讨论】: