我尝试在 Python 上创建一个 ssh 类。
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username=username, password=password)
stdin, stdout, stderr = ssh.exec_command('ls -l')
ssh.close()
此代码提供连接服务器,但是当我尝试连接另一台服务器时,出现此错误:
userauth is OK
transport._log() => Authentication type (publickey) not permitted.
transport._log() => Allowed methods: ['password']
transport._log() => EOF in transport thread
我无法解决错误。任何想法?