sshfs-win
sshfs-win copied to clipboard
net use: error 67 with `\\sshfs.k\`, works with `\\sshfs\` & `sshfs-win svc \sshfs.k\`
I'm trying to move over my server to only allow key authentication and disable passwords; unfortunately, sshfs is my last dependency that doesn't want to play ball.
Everything has been working well for a year with net use Y: \\sshfs\centril@centrilnas2
.
Now, using the latest release ([email protected] & [email protected]), I cannot seem to get sshfs.k
to work via net use
(or the corresponding Windows UI). When I do net use Y: \\sshfs.k\centril@centrilnas2
, I get back:
λ net use Y: \\sshfs.k\centril@centrilnas2
System error 67 has occurred.
The network name cannot be found.
Meanwhile, with sshfs-win svc
, I am able to use key authentication:
λ "C:\Program Files\SSHFS-Win\bin\sshfs-win.exe" svc \sshfs.k\centril@centrilnas2 Y:
Warning: Permanently added 'centrilnas2,192.168.0.115' (ECDSA) to the list of known hosts.
Enter passphrase for key '/cygdrive/c/Users/twing/.ssh/id_rsa':
The service sshfs has been started.
(and the drive shows up as a mapped drive).
What does the sshfs.k entry under the registry key HKLM\SOFTWARE\WOW6432Node\WinFsp\Services
look like?
Like so:
Key Name: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WinFsp\Services\sshfs.k
Class Name: <NO CLASS>
Last Write Time: 2020-07-26 - 15:35
Value 0
Name: Executable
Type: REG_SZ
Data: C:\Program Files\SSHFS-Win\bin\sshfs-win.exe
Value 1
Name: CommandLine
Type: REG_SZ
Data: svc %1 %2 %U
Value 2
Name: Security
Type: REG_SZ
Data: D:P(A;;RPWPLC;;;WD)
Value 3
Name: JobControl
Type: REG_DWORD
Data: 0x1
Value 4
Name: Credentials
Type: REG_DWORD
Data: 0
Open the Event Viewer and look under Windows Logs > Application. Try your net use
command and you should see some entries with Source=="WinFsp"
. They should be from launcher-x64
, the WinFsp service that is used to launch file systems when using the net use
command. Can you please report what you see there?
I get two events:
Log Name: Application
Source: WinFsp
Date: 2020-07-27 08:59:43
Event ID: 1
Task Category: None
Level: Information
Keywords: Classic
User: N/A
Computer: centrilg55
Description:
launcher-x64: create sshfs.k\centril@centrilnas2!9099 = c0000035
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WinFsp" />
<EventID Qualifiers="24576">1</EventID>
<Level>4</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2020-07-27T06:59:43.332682400Z" />
<EventRecordID>10904</EventRecordID>
<Channel>Application</Channel>
<Computer>centrilg55</Computer>
<Security />
</System>
<EventData>
<Data>launcher-x64</Data>
<Data>create sshfs.k\centril@centrilnas2!9099 = c0000035</Data>
</EventData>
</Event>
Log Name: Application
Source: WinFsp
Date: 2020-07-27 08:59:11
Event ID: 1
Task Category: None
Level: Information
Keywords: Classic
User: N/A
Computer: centrilg55
Description:
launcher-x64: create sshfs.k\centril@centrilnas2!9099 = c0000035
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WinFsp" />
<EventID Qualifiers="24576">1</EventID>
<Level>4</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2020-07-27T06:59:11.077534300Z" />
<EventRecordID>10903</EventRecordID>
<Channel>Application</Channel>
<Computer>centrilg55</Computer>
<Security />
</System>
<EventData>
<Data>launcher-x64</Data>
<Data>create sshfs.k\centril@centrilnas2!9099 = c0000035</Data>
</EventData>
</Event>
Thank you. These event messages are rather illuminating:
launcher-x64: create sshfs.k\centril@centrilnas2!9099 = c0000035
This message is logged by the Launcher when trying to create the new process for the user mode file system (called a "service instance" in Launcher terminology). The c0000035
status code is STATUS_OBJECT_NAME_COLLISION
. The most likely reason for the status code is that the named service instance already exists, because this test fails.
In plain English it is likely that you already have a file system running as \sshfs.k\centril@centrilnas2!9099
. To confirm this use the launchctl-x64.exe
utility found in the WinFsp bin
directory (usually at the C:\Program Files (x86)\WinFsp\bin
directory). For example, you can run launchctl-x64 list
to see all running instances and launchctl-x64 info CLASS INSTANCE
to get information on an instance. (The Launcher breaks down a UNC prefix of \sshfs.k\centril@centrilnas2!9099
into a CLASS of sshfs.k
and an INSTANCE of centril@centrilnas2!9099
).
Hmm; so I tried the following sequence:
λ & 'C:\Program Files (x86)\WinFsp\bin\launchctl-x64.exe' list
OK
sshfs.k centril@centrilnas2!9099
λ & 'C:\Program Files (x86)\WinFsp\bin\launchctl-x64.exe' stop sshfs.k centril@centrilnas2!9099
OK
λ & 'C:\Program Files (x86)\WinFsp\bin\launchctl-x64.exe' list
OK
λ net use Y: "\\sshfs.k\centril@centrilnas2!9099"
System error 67 has occurred.
The network name cannot be found.
λ & 'C:\Program Files (x86)\WinFsp\bin\launchctl-x64.exe' list
OK
sshfs.k centril@centrilnas2!9099
λ & 'C:\Program Files (x86)\WinFsp\bin\launchctl-x64.exe' info sshfs.k centril@centrilnas2!9099
OK
sshfs.k centril@centrilnas2!9099
"C:\Program Files\SSHFS-Win\bin\sshfs-win.exe" svc "\sshfs.k\centril@centrilnas2!9099" "Y:" "CENTRILG55\twing"
At this point, the path Y:\
doesn't work. So I tried:
λ "C:\Program Files\SSHFS-Win\bin\sshfs-win.exe" svc "\sshfs.k\centril@centrilnas2!9099" "Y:" "CENTRILG55\twing"
Warning: Permanently added '[centrilnas2]:9099,[192.168.0.115]:9099' (ECDSA) to the list of known hosts.
Enter passphrase for key '/cygdrive/c/Users/twing/.ssh/id_rsa':
The service sshfs has been started.
Now Y:\
shows up in the file system and is usable, but closing the terminal unmount it.
Note: when I do ssh nas
, with ssh -V
yielding OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2
with:
λ cat C:\Users\twing\.ssh\config
Host nas
User centril
HostName centrilnas2
Port 9099
IdentityFile ~/.ssh/id_rsa
I don't get the message about "Permanently added..." and there's no prompt for my passphrase; perhaps this is the root of the issue?
there's no prompt for my passphrase; perhaps this is the root of the issue?
It looks like this is the problem. The sshfs.k
is used for "password-less" authentication using private keys. It does not support passphrases.
It's likely that after your net use
command the Launcher starts the file system, which is then stuck in the prompt Enter passphrase for key ...
. This is OK for the Launcher because it was told that the file system did not require Credentials
(recall that Credentials==0
in the registry entry you sent earlier). But it is not ok for net use
which will eventually timeout waiting for the file system to come online.
The way SSHFS-Win currently works is: you either get password-based authentication (with the possibility of having the password remembered in the Windows Credential Manager) using the prefixes sshfs
and sshfs.r
, or password-less authentication with a private key using the prefixes sshfs.k
and sshfs.kr
.
ssh -V yielding OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2
To clarify SSHFS-Win uses its own builtin SSH and cannot work with Windows OpenSSH.
Ah, I see; that explains it then. :)
I was hoping that ssh-agent
would help alleviate this issue, as I don't have to input the passphrase normally when using just plain ssh nas
, but it doesn't seem like it does.
Would it be possible to use ssh-agent
with SSHFS-Win somehow or alternatively pass the passphrase?
I am fairly certain that others have managed to use sshfs-win with ssh-agent, although they usually resort to custom scripts that drive the sshfs-win.exe
or sshfs.exe
programs rather than using the Launcher infrastructure.
I believe SiriKali may supports this scenario as well.
alternatively pass the passphrase
Everything is possible of course. At present it is unlikely that I would find any time to put into this.
One possible reason is non-ascii characters in computer name and/or network name. Please refer #192, #193 in that case.
Can attach myself here as experiencing the same issue as OP and there are no non-ascii characters in my usage
Using ssh-agent or pagent (Putty SSH Agent) would be a great feature to support. We use it for everything.
using SiriKali fixed all the issues I had with sshfs