PowerShell / PowerShell/Win32-OpenSSH
Copying files by sftp to junction not possible under Windows 10 when ChrootDirectory is set in sshd_config
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 8.3k
- Forks
- 819
- PR merge metrics
- No merged PRs in 30d
Description
When I try to copy files to a symlinked / junctioned folder in Windows 10, I get a file of 0KB size and an error "permission denied". Steps to teproduce:
1.) Install the latest OpenSSH Build for Windows (in my case 1607 LTSB, so I install it manually, by downloading the package from the binaries page on Github)
2.) In the Windows file system, create a folder Symlinks on C:. Also create a folder Temp on C:\ to copy data to later
3.) In the Windows file system, create a Junction like this: mklink /J C:\Symlinks\C C:\
4.) In the sshd_config, set: ChrootDirectory C:\Symlinks
5.) Access your sftp Server using Winscp, Filezilla or a client of your choice
6.) In the sftp client, navigate to /C/Temp (note: /C is the junction we created in setp 3)
7.) the copy process will fail, creating a file of 0KB size, and a permission denied error.
Additional information: if you do NOT set ChrootDirectory, you will be taken to the Users Homepath by default. If you do so, and navigate to your /C/Symlinks/C/Temp folder, and then try to copy a file, everything works fine. So this seems not to be related to any permission issues in Windows. It is some strange behaviour of OpenSSH in combination with ChrootDirectory and Junctions.
Any idea why this is happening? If you need more information, feel free to ask!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure using the listed Windows 10 setup, the sshd_config ChrootDirectory C:\Symlinks setting, the C:\Symlinks\C junction, and an SFTP client. Compare transfers through the junction with and without ChrootDirectory; done means the /C/Temp upload succeeds without creating a 0KB file or returning permission denied.
Written by the indexing model from the issue text.
Assessment
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100