首页 > 技术文章 > paramiko远程连接服务器报错:paramiko.ssh_exception.SSHException: Server '10.114.2.3' not found in known_hosts

xiaofeng91 2021-07-27 10:20 原文

# 创建SSH对象
ssh = paramiko.SSHClient()
# 允许连接不在know_hosts文件中的主机
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) -----加上这一句
# 连接服务器
ssh.connect(hostname=hostname,port=22, username=username, password=password)

推荐阅读