Python - Pxssh - Getting an password refused error when trying to login to a remote server

前端 未结 2 1558
鱼传尺愫
鱼传尺愫 2021-01-16 09:00

I\'m trying to use the pexpect module pxssh to log in into my one of my server. I get password refused. I think I know what it is the problem, but can\'t figure out how to f

2条回答
  •  不思量自难忘°
    2021-01-16 09:42

    I don't know if you are right on your diagnostic, I don't think the banner can cause that but a wrong prompt can do it for sure. Look at the code to be sure. http://www.opensource.apple.com/source/lldb/lldb-69/test/pexpect-2.4/pxssh.py

    Especially that part:

     elif i==2: # password prompt again
                # For incorrect passwords, some ssh servers will
                # ask for the password again, others return 'denied' right away.
                # If we get the password prompt again then this means
                # we didn't get the password right the first time. 
                self.close()
                raise ExceptionPxssh ('password refused')
    

    Disclaimer: this is not my code but Pxssh code. Why not using paramiko (http://www.lag.net/paramiko/) or pexpect directly?

提交回复
热议问题