I had this problem and resolved it.
Initially I followed the answer from Константин Брызгалов and was able to login with a password, but could not get public key authentication working. (I had created a local cyg_server administrator account manually.)
On further investigation, I was reading this page and it said to avoid having both a domain and a local account. I checked and I did have both; apparently someone else in my organization is running a cygwin server and had already created a cyg_server on the domain, which was getting confused with my local account.
I deleted my local cyg_server account, uninstalled the sshd service, and reinstalled as described on that page, and everything worked perfectly out of the box. The trick was to say "no" to using the existing cyg_server account, and tell ssh-host-config to create a "cyg_server1" account. It created a local account and set everything up correctly. Specifically:
- cygrunsrv --stop sshd
- cygrunsrv --remove sshd
- Ctrl Panel > User Accounts > Manager User Accounts > (delete local cyg_server account)
- mkpasswd -l -d >/etc/passwd
- mkgroup -l -d >/etc/group
- ssh-host-config
- overwrite = yes
- strict = yes
- CYGWIN = ntsec
- user to run = cyg_server1
- password = {...}
Checking user accounts you will see that cyg_server1 is indeed a local account but has additional setup.
1Seems like /bin/bash is either deleted or your user doesn't have permissions to it. You should probably contact the administrator and ask him to fix it. – Mikael Kjær – 2017-09-14T08:52:52.167
Can you login with another user? – Zumo de Vidrio – 2017-09-14T08:53:12.660
@MikaelKjær Hm, if bash is missing wouldn't the error message be "command not found" or some such? Likely you're right about the permissions though. – sashoalm – 2017-09-14T08:53:48.797
@ZumodeVidrio I asked one of my colleagues and she get the same error. – sashoalm – 2017-09-14T08:56:12.067
This bash error is coming from the Linux server. The cause is maybe a bad command in the file
.bashrc
of the user profile you are connecting to. – harrymc – 2017-09-19T12:59:04.363@harrymc It's a windows server with cygwin. – sashoalm – 2017-09-19T13:05:09.993
If you don't know where
.bashrc
is located under cygwin, you could run on the server the commandecho $HOME
on the same user profile you are connecting to. – harrymc – 2017-09-19T13:21:16.787