Skip to content

Copying files by sftp to junction not possible under Windows 10 when ChrootDirectory is set in sshd_config #1403

Open
@Erik78De

Description

@Erik78De

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions