我尝试在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
我无法解决错误。任何想法?