diff --git a/mitogen/ssh.py b/mitogen/ssh.py index 2e723d67..f8255865 100644 --- a/mitogen/ssh.py +++ b/mitogen/ssh.py @@ -289,7 +289,11 @@ class Stream(mitogen.parent.Stream): self._host_key_prompt() elif HOSTKEY_FAIL in buf.lower(): raise HostKeyError(self.hostkey_failed_msg) - elif buf.lower().startswith(PERMDENIED_PROMPT): + elif buf.lower().startswith(( + PERMDENIED_PROMPT, + b("%s@%s: %s" % (self.username, self.hostname, + PERMDENIED_PROMPT)), + )): # issue #271: work around conflict with user shell reporting # 'permission denied' e.g. during chdir($HOME) by only matching # it at the start of the line.