In our company we are using cygwin on each of our machines to be able to run our projects with GNU make (everyone uses Windows 10)! I also developed a tool, with which all employees are able to synchronize their projects from their (slow) machines to our server (Windows Server 2012 R2), run the make on the (fast) server, and synch the output back.
All that works with a cygwin ssh connection!
- Cygwin (also ssh service) on the server is up and running on C:\tools\cygwin
- Added Domain user group to /etc/group of cygwin installation (means everyone can login with their windows password!)
Added every user to passwd file. Looks like this:
Mapped following directories in fstab file:
- C:/tools/cygwin /
- C:/projects /home (because the home folder of every user is: C:\projects\username)
- C:/tools/cygwin/bin /usr/bin
- C:/tools/cygwin/lib /usr/lib (I cannot remember why I mapped point 3 & 4)
Created RSA keys for EVERY user on the user's machine and put it into his/her home folder on the server. Everyone is now able to connect to his folder on the server without giving his/her windows password again (I had to do this because my tool to synch works with 'rsync')
What I want now is, to restrict every user, who connects to the server via ssh, to its home folder /home/'username'
For example: A user's username in our domain is u89x77. He's able to login normally via ssh but is also able to cd for example into C:\Windows or worse into C:\projects\'other username'\'absolute secret project'. And that is not what I want.
The user should be blocked to cd out of C:\projects\u89x77 but of course needs to look inside his folder like cd C:\projects\'u89x77\'u89x77 project'.
I tried a lot of things up to now and also made a lot of research. But unfortuneatly nothing worked...
Adding following into /etc/sshd_config on the server's cygwin, I could not connect anymore (Connected and immediately Closed with Exit status 255) and that would also not lead to what I exactly want. Because it would restrict the users to C:\projects\ and not to exactly their folder...:
ChrootDirectory /home Subsystem sftp internal-sftp
I also read something about mounting the C:\tools\cygwin directory to each user's home directory, because the connected user will not be able to access the cygwin bin/bash anymore? (in /etc/passwd the last entry /bin/bash...) I tried but still the same error.
I am missing something but there are so many options to set this up I just need someones help now....
PS: It was my first post I hope I did not fail to many guidelines. Sorry for that!