15

A Windows-10 64-bit PC was outfitted with:

  • winfsp - msi download of latest release version or the Github project
  • sshfs-win - msi download of latest release version or the Github project

A remote linux directory (mydirectory) is to be mounted to S:. The syntax is documented here.

"Baby steps" indicating preliminary success (non-Admin CLI):

net use S: \\sshfs\[email protected]\..\..

however this does not mount mydirectory

Other user's attempts to mount target directory have failed. Attempt from the Admin command-line failed:

net use S: \\sshfs\[email protected]\\mnt\MOUNTPOINT\mydirectory

System Error 67 has occured. The network name can not be found

Other failures:

net use S: \\sshfs\[email protected]\mnt\MOUNTPOINT\mydirectory
net use S: \\sshfs\[email protected]:\mnt\MOUNTPOINT\mydirectory

for some reason, the syntax is such that I am required to type the username and password despite inputting the username: user@hostname

  • What is the correct syntax to mount mydirectory to the S: drive?
  • What diagnostics can be performed to determine corrective action?
2
  • I got "System Error 67". Turned out my ssh server wasn't actually running XD Aug 27, 2019 at 12:25
  • I ended up paying $50 for ExpanDrive which doesn't ever break. Oct 11, 2020 at 0:40

6 Answers 6

12

In my Windows 10 mounting home directory of remote ssh server worked in user's powershell using command

net use S: \\sshfs\user@host\.

Note single dot at the end! Without the dot it did not work. For mounting root folder, use

net use S: \\sshfs\user@host\..\..

The same works (but with different syntax) on Windows Explorer -> This PC -> Map network drive. In my system I had to enter the path with leading two backward slashes: for root

\\sshfs\user@host/../..

for home

\\sshfs\user@host/

Note forward slashes here! You may need to mark "Use different credentials" and enter username / password in several subsequent dialogue boxes.

4
  • 5
    Finally! ... \\sshfs\user@host!port/ was what I needed so I could map a local Windows 10 drive letter to a Linux folder via ssh.) Thanks.
    – ashleedawg
    Dec 3, 2019 at 14:58
  • 6
    You can use net use S: \\sshfs.r\user@host (note .r after sshfs) command to mount root directory.
    – anton_rh
    Mar 31, 2020 at 10:36
  • 1
    How do you pass options like auto_cache, cache_timeout etc with net use command?
    – Jags
    May 21, 2020 at 16:58
  • @Jags for that, you need to use the custom frontend sshfs-win like sshfs-win svc \sshfs\LOCALUSER=remoteuser@host X: your sshfs options
    – Sz.
    Jan 19, 2022 at 2:54
7

Simple answer:

Use \\sshfs.r instead of \\sshfs

Long answer:

The simple syntax to access a remote folder is:

\\prefix\remoteuser@host[\path]

According to the SSHFS-Win readme, there are 4 prefixes to use when specifying the connection (section UNC Syntax):

"sshfs", "sshfs.r", "sshfs.k", "sshfs.kr"

The prefix affect how the path is interpreted. In "sshfs", the path is relative to the remoteuser's home folder (usually /home/remoteuser). So, when you do

net use S: \\sshfs\[email protected]\mnt\MOUNTPOINT\mydirectory

You are trying to mount /home/user/mnt/MOUNTPOINT/mydirectory

In this case you should use the sshfs.r prefix, where the path is relative to the root directory (/):

net use S: \\sshfs.r\[email protected]\mnt\MOUNTPOINT\mydirectory

I hope this helps.

1
  • 1
    This should be the accepted answer. Using ../.. is not a good solution (as others have mentioned) because a user's home directory is NOT guaranteed to be in /home/user. It can be in another path based on how the admin designed the system.
    – cmevoli
    Sep 22, 2022 at 18:54
4

The net use command did not work for me, admin or not, PowerShell or CMD.

  1. Open Windows Explorer
  2. Find this pc, right-click on it
  3. Select map network drive
  4. Enter \\sshfs\[email protected]/../../etc/blabber/mouth in Folder
  5. Check "Connect using different credentials".
  6. Hit Enter

Notes:

Windows 10 seems to be funny about permissions and folders here.

If you map \\sshfs\[email protected]/ you'll be stuck in your home folder and whatever sub folders it has. But you should be able to read and write.

If you map \\sshfs\[email protected]/../.. You'll be at the root folder, but will be stuck with whatever permissions your user has for the root for all folders. If you don't have write access on the root folder, you won't have write access on anything below it because Windows.

If you map \\sshfs\[email protected]/../../etc/blabber/mouth You'll have whatever permissions your user has on folder 'mouth', but you'll be stuck in that folder, same as your home folder.

For newbs, adding /../.. is the equivalent of going into your home folder and typing cd ../.. Also the: is ignored/not needed in Windows mapping.

On Linux I can mount the remote root folder and operate as if I'm local to the machine; I can navigate to any folder.

On windows, there are quirks and restrictions you have to work around, so it's better to mount the folder you need to work in. Inconvenient if you need access to multiple folders, but it works.

4
  • 2
    Just type `\sshfs\[email protected]//' to get to the root folder. Feb 7, 2020 at 16:00
  • Is it possible to send options like auto_cache and cache_timeout with "map network drive" wizard?
    – Jags
    May 21, 2020 at 17:00
  • Thanks a lot, @RoyH, that helped a lot
    – Hossein
    Dec 27, 2020 at 7:53
  • @SzieberthAdam, that gave The network name cannot be found for me. However, the sshfs.r prefix hack (from anton_rh at another answer) did work.
    – Sz.
    Jan 19, 2022 at 3:01
1

This command works for me in the non-admin powershell in Windows 10:

net use S: \\sshfs\[email protected]\..\..\my_remote_directory

This did not work for me in cmd, but neither did the first baby step.

I originally found this question when trying to use map network drive in the GUI for a remote folder in windows 10. Your baby step lead me to something that worked. I was able to mount a remote directory with the below in the folder field.

\\sshfs\[email protected]\..\..\my_remote_directory
3
  • 1
    Please show the exact command that you used.   Please do not respond in comments; edit your answer to make it clearer and more complete. May 10, 2019 at 21:07
  • Alright, I hope it is better now. May 11, 2019 at 2:13
  • The .. was the key for me. Sep 4, 2019 at 17:39
0

If you're getting an access denied error then you probably have a permissions issue, not a syntax problem. Verify that your ssh user has permissions to ssh into the server and also that the user has permissions to access that specific directory. You also might want to try running the command from an administrative prompt in Windows to make sure that it's not a Windows permission issue with sshfs.

3
  • Terrific insight! The user account has root access and works as expected under Ubuntu.
    – gatorback
    Apr 9, 2019 at 21:59
  • Did you try running the command in windows from an administrative cmd prompt not not just a regular user cmd prompt?
    – Jeff
    Apr 10, 2019 at 1:06
  • Yes, attempts from admin and non-admin CLI. Significant edits (more detail) added to original posting to enable your good questions.
    – gatorback
    Apr 10, 2019 at 12:59
0

I followed Roy H advice on this post and it worked for me. Here is what I needed and done:

  • Map network drive from home-Windows10 to work-Windows10 for collaborators access to shared folder. I am the administrator.

  • Set new user ("collaborator"), new group ("Users") and relative permissions on work-Windows10 using "Computer Management" utility under Windows Administrative Tools. I also set the permissions and security for the shared folder to "Full Control" for "Authenticated Users".

  • Map new drive under "This PC" in Windows Explorer. Use default "Z" drive. Under folder used "\\sshfs\[email protected]/../../Users/admin/Documents/WorkData1". Checked "Reconnect at Sign-in". Unchecked "Connect Using Different credentials".

  • FYI: Open a Powershell administrator instance and navigate to shared folder. Used "Get-Acl" at prompt to check permissions. Under "Access" value is " NT AUTHORITY\Authenticated Users Allow FullControl..."

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .