Windows – How to add/remove drives to Windows OpenSSH SFTP server

opensshsftpwindows 10winscp

I've setup the built-in OpenSSH in Windows 10 and connected remotely via WinSCP SFTP protocol. I seem to have access to all folders in my C: drive, but I cannot access the external drives of my computer. Going to the "root" folder just lists the C: drive. I tried creating a soft directory symlinks in a directory that I can access, but that doesn't seem to work. They appear as files in WinSCP and I cannot access them. How can I add them? Also, is there a way to restrict access to certain folders if I wanted to share access to only certain folders of my server?

Best Answer

While some Windows SFTP servers do implement a virtual root folder which lists available drives, Win32-OpenSSH does not. It redirects the root folder / to /C:/ (or maybe to a system drive).

If you want to visit another drive, you have to manually change a working directory.

  • In WinSCP GUI, you can do that using "Open Directory" command and typing a path to the desired drive, like /D:/.

  • In command-line SFTP clients, like OpenSSH sftp, PuTTY psftp or WinSCP scripting, you can use cd command, like:

    cd /D:/
    

There's actually WinSCP FAQ for How do I change drive on the remote panel?


Regarding your attempt to solve this using a symlink: A symlink really shows as a file in WinSCP (as the server presents it as an unknown file type). But a directory junction shows as a directory (the server presents it as a regular directory, not a link). Though since WinSCP 5.14.2, you can make WinSCP try to enter "file" using Ctrl+PgDn.

Related Question