sshfs-win icon indicating copy to clipboard operation
sshfs-win copied to clipboard

Can't map drive inside Explorer or with NET USE

Open lucipacurar opened this issue 4 years ago • 7 comments

I'm trying to map a drive to my NAS using SSHFS-Win. From Explorer or CMD I can't get it to work and it throws the following error:

PS C:\Program Files\SSHFS-Win\bin> net use X: \\sshfs\[email protected]\Data
The password is invalid for \\sshfs\[email protected]\Data.

Enter the user name for 'sshfs': admin
Enter the password for sshfs:
System error 5 has occurred.

Access is denied.

But it works pretty much fine with:

sshfs -d -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o Port=22 -o idmap=admin -o cache_timeout=1 -o FileInfoTimeout=-1 -o DirInfoTimeout=1000 [email protected]:/Data M:

And it also works fine using SSHFS-Win Manager.

Any idea on where to start debugging?

Thank you!

lucipacurar avatar Jun 08 '20 15:06 lucipacurar

it may seem strange but try to launch the command from an elevated administrator command prompt as a starting point :-)

https://www.windows-commandline.com/system-error-5-has-occurred/

Rizos39 avatar Jun 17 '20 22:06 Rizos39

it may seem strange but try to launch the command from an elevated administrator command prompt as a starting point :-)

https://www.windows-commandline.com/system-error-5-has-occurred/

I already tried that, and still doesn't work :( I was so much looking forward on ditching Samba

lucipacurar avatar Jun 18 '20 12:06 lucipacurar

I have same issue on windows 10 trying to connect to my android phone via ssh.

LinArcX avatar Apr 30 '21 12:04 LinArcX

Found the problem here, at least for me - it was on the server side. I needed to add some sftp specific config in sshd_config and it finally connected. Steps:

  1. Create a group, for instance sftp
  2. Add the user you will connect with to it
  3. Add something like this to the end of your sshd_config:
Match group sftp
    ChrootDirectory [whatever folder you want to mount]
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp

This should be enough to connect, though you might need to enable PasswordAuthentication too, if you prefer it (I used public key).

bundyo avatar May 28 '21 07:05 bundyo

Confirming also, tried all recommendations and still receive the error.

risharde avatar Jun 06 '22 17:06 risharde

It seems like this is hard-coded to use port 22 only.

That's a ridiculous design decision, @billziss-gh !!!! Some of us use unrooted Androids (because Motorola is a big POS and will not let me unlock my bootloader to root -- that's a different thing) and I have to use a non-standard port.

HOW the F*** do I connect with this POS???

W9JYD avatar Mar 27 '23 08:03 W9JYD

Can confirm that changing the port from my NAS' SFTP settings to 22 fixes this.

seirdotexe avatar Apr 09 '23 15:04 seirdotexe