Cygwin OpenSSH closes immediately after a connection
For some reason this worked for me when I had the same problem:
ssh 127.0.0.1 /bin/bash
But if bash is the problem, the same thing would happen. so if that doesn't work, you might learn more by just trying to run any command, e.g.:
ssh 127.0.0.1 ls
Also see here:
https://serverfault.com/questions/384676/linux-closing-connection-after-successful-login
Since Cygwin runs on Windows, it could be due to the enter key typing \r before the \n, meaning "\r" would be the command you're trying to run instead of /bin/bash, so it runs \r as bash script and exits. I am only experiencing this using Cygwin on Windows 8.
If I'm not mistaken, on Linux, this or something similar can happen if the specified shell for the account you're trying to log into is /bin/false
, which is a way to prevent an account from being able to do anything via a shell.
I don't know if Cygwin's sshd
checks /etc/passwd
to find out what shell to spawn but maybe check that file and see if your account is listed, or try chsh
from the console and specify /bin/bash
or similar as the shell.