#StackBounty: #ssh #windows-server-2012-r2 #cygwin #fstab #cygwin-sshd cygwin: chroot jail – cannot run any command

Bounty: 50

I have installed Cygwin with Apache, PHP, Mercurial, MYSQL, OpenSSH, PYTHON

I have updated sshd_config to chroot jail
to access user-defined folders


Match group sftp_users

ChrootDirectory /home/%u

SSH / SFTP works fine as I wanted.

After my connection to SSH, I get bash. There if I want to run any command like 'dir, hg, mysql, whatever‘ I simply get command not found

googling for days I tried below steps

  1. copying all files from C:/cygwin/bin to ‘C:/cygwin/home/username/bin’ and similarly dev,etc,lib,sbin,tmp,usr,var – this actually gives me different error something like error while loading shared libraries
  2. I tried updating on fstab like C:/cygwin/bin /bin ntfs binary 0 0 even that didn’t make any change in my SSH connection command
  3. I tried adding path while making the SSH connection like plink.exe ssh -pw xxx username@hostname -v C:/cygwin/bin/python and I also tried plink.exe ssh -pw xxx username@hostname -v ../bin/python
  4. If I change sshd_config to its default, somehow the command works but I get wired output similar to the image below
    Command prompt response after plink SSH connection-wired

help me this could save my life.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.