Paramiko/Python: Keyboard interactive authentication

帅比萌擦擦* 提交于 2019-11-28 00:30:00

Your server is using a keyboard-interactive authentication, not a simple password authentication.

Normally Paramiko is smart enough to fallback to the keyboard-interactive authentication, when the password authentication fails and the keyboard-interactive prompt has one field only (likely a password).

The problem is that your server behaves, as if the password authentication succeeded.

You can explicitly make Paramiko try the keyboard-interactive authentication using this code:

def handler(title, instructions, fields):
    if len(fields) > 1:
        raise SSHException("Expecting one field only.")
    return [password]

transport.connect(username='myuser')
transport.auth_interactive(username, handler)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!