Windows – PuTTY error: /bin/bash Operation not permitted when connecting to Cygwin sshd

bashcygwin;puttysshwindows

When trying to connect to an SSH server using PuTTY, I get an error:

/bin/bash: Operation not permitted

And then I get a message box saying:

Connection closed by remote host

This started happening unexpectedly today and I have no idea why, the SSH connection used to work fine before that.

enter image description here

What is causes this error, and is there any way to fix it?

Edit: The server is a Windows box, not Linux, and it is running Cygwin's sshd. Also I found this post which I think might be relevant – https://cygwin.com/ml/cygwin/2016-03/msg00097.html

Best Answer

Here is a more direct way doing what the previous posts by Константин Брызгалов and Mun-dee say. Run a cygwin terminal as Administrator, then:

# stop the running sshd:
net stop sshd
# give the ssh user required privileges:
editrights -a SeTcbPrivilege -u cyg_server
editrights -a SeAssignPrimaryTokenPrivilege -u cyg_server
editrights -a SeCreateTokenPrivilege -u cyg_server
# restart sshd:
net start sshd
Related Question