Closed andyneff closed 4 years ago
From your description it appears that you are doing things properly and it is not obvious what the problem is. But you seem to be having a lot of problems with SSHFS-Win, which makes me wonder about some deeper problem.
Same error here, just want to mount a remote FS through SSH but can't login (trying to use the same private key which I use to login with PuTTY).
Here's what I tried to do:
choco install sshfs
installs the old 2.7 version, apparently (Which #141 claims helped with the address bar issue in explorer.exe
)
sshfs 2.7.17334
winfsp 1.6.20027
sshfs-win cmd {username}@{computername}:/tmp X:
I can tell by looking at the ssh server's /var/log/secure
messages that no ssh attempts are being made (I'm just starting to monitor this file).
Again, the UNC versions so not work.
However, I now see messages in /var/log/messages
and /var/log/secure
While my local ~/.ssh/config
files (which SSHFS's ssh.exe
appears to use when I call it directly) says PreferredAuthentications gssapi-with-mic,hostbased,publickey,password,keyboard-interactive
, It appears it is use not using password
authentication, but keyboard-interactive
(but I could be wrong about this). At any rate, I've verified it is sshing into my destination machine with the right username (which it probably was all along), it's just not getting the right password in... (I have a WSL idea I want to try next... O:-)
Any ideas how I can debug the password that is being sent or see the login interaction of with ssh?
Ok, So I did a little MITM Python digging, and I've proven to myself that sshfs-win
is being run by user: "nt authority\system" with admin privileges, which I was sort of expecting once I knew to ask the question...
I have further proven that as "nt authority\system" with admin privileges, if I use SSHFS's ssh command, it will no longer be using "my" ~/.ssh/config file, but "nt authority\system"'s which does not exist... ("nt authority\system"'s home dir is C:\Windows\system32\config\systemprofile
)
As admin, I created an "nt authority\system" command prompt:
PsExec.exe -i -s %SystemRoot%\system32\cmd.exe
whoami
- nt authority\system
, and I also have admin privileges..ssh.exe
and it was not using my, so was indeed not using "password" authentication mode, like I wanted. This explains why when I read my sshd server's logs, it appear to be failing in keyboard-interactive authentication... because it was!
So all I did to fix my problem was to update the registry keys in:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WinFsp\Services\sshfs*
CommandLine
: svc %1 %2 %U -oPreferredAuthentications=password
Unfortunately this particular fix is very specific to me, so not really useful to the community...
However, since %U
tells sshfs-win svc
the username, It maybe a better solution for all to:
c:\User\{name}
, it often has other prefixes/suffixes added. So asking windows the home dir would be important (I'm not actually sure how to do this right, I know python does it wrong, but MINGW bash does it right)-F{home_dir}/.ssh/config
CommandLine
: svc %1 %2 %U -FC:\Users\{hard_code_of_my_homedir}\.ssh\config
Worked too!I think this solution has a lot of flexibility for all, allowing you to edit your config file, and have sshfs-win
use that (in svc
only, not cmd
). Thoughts?
@andyneff the latest beta of WinFsp supports a %P
that can be used to get the profile directory of the user. This would make your CommandLine: svc %1 %2 %U -F%P\.ssh\config
I want to start with: Thank you for all your hard work!!!
This is so VERY close to working... it comes down to quotes. And I will admit, I know glibc quotes like the back of my hand, I have never learned windows quotes, because most of my windows coding is in python, and python args make windows quotes behave exactly like glibc quotes, so I've never had to learn them
HKLM\SOFTWARE\WOW6432Node\WinFsp\Services\sshfs*\CommandLine
to svc %1 %2 %U -F%P\.ssh\config
(exactly)sshfs-win.exe svc \sshfs.r\{user}@{hostname}\tmp X: {local_username} -FC:\Users\{username}\.ssh\config
"sshfs-win.exe" svc "\sshfs.r\{user}@{hostname}\tmp" "X:" "{local_username}" -F"C:\Users\andy\.ssh\config"
"sshfs-win.exe" svc "\sshfs.r\{user}@{hostname}\tmp" "X:" "{local_username}" -F"C:\Users\andy"\.ssh\config
read: Connection reset by peer
KO
So it looks like windows wasn't happy with that, if that is indeed the issue, I'm not sure what you would prefer moving forward? Some ideas to spitball:
SvcInstanceReplaceArguments
, that if the letter is lowercase, FALSE
be used instead of Quote
%P(\.ssh\config)
expands the right way. I think that add extra complication, but I don't really know what your vision isI am surprised the quotes around %P do not work. I tried this with a different (non-Cygwin) based file system and I believe they worked. I will have to revisit the quote handling.
I did my tests in cmd.exe, I thought that best represented WinFSP's environment.
Same problem. Sorry, I made a duplicate #192 I have this problem on my home PC (Win 10 Home) At work everything is OK, I can mount in Windows Explorer (Win 10 Enterprise)
I tried SFTP Drive Personal Free on my Win 10 Home. It works fine...
@andyneff the command line handling bothered me enough that I finally found some time to investigate more.
I believe the problem is that SSHFS-Win is a Cygwin executable and Cygwin's default command line handling differs from the one in Windows.
When you pass:
"sshfs-win.exe" svc "\sshfs.r\{user}@{hostname}\tmp" "X:" "{local_username}" -F"C:\Users\andy"\.ssh\config
Cygwin sees the arguments:
sshfs-win.exe
svc
\sshfs.r\{user}@{hostname}\tmp
X:
{local_username}
-FC:\Users\andy.sshconfig
The fix is to use slash instead of backslash (untested):
svc %1 %2 %U -F%P/.ssh/config
I will not pretend to fully understand that, but it did indeed work!!!
Thank you for all your hard work!
Glad this worked for you in the end!
I've encountered a similar problem related to specifying key locations in your config.
Changing IdentityFile ~/.ssh/mykey
to IdentityFile C:/Users/myuser/.ssh/mykey
may fix additional problems for some people.
Mapping a network drive with explorer runs the command under the SYSTEM user which can mess up the ~
expansion. This was the case for me, although it didn't use to be a problem. I had this working before but after a windows update (unsure if related) it caused this problem.
Found from running sshfs-win.exe svc ...
under SYSTEM.
@ScottNotFound Using ~myusername/.ssh /id_rsa
instead of ~/.ssh /id_rsa
in your configure might allow slightly less path coding?
While I can mount using
sshfs.exe
andsshfs-win.exe
, I am unable to use any of the GUI way ornet use
, which all use the UNC path to mount. What am I doing wrong?Is it possible that password with special characters (not unicode) don't work?
Version info
SSHFS version 3.5.2 FUSE library version 3.2 WINFSP 1.6 Windows 10 Pro: 10.0.19041
Problem
net use y: \\sshfs.r\username@computername\tmp
ornet use y: \\sshfs.r\username@computername
sshfs-win.exe
,sshfs.exe
, and SSHFS'sssh.exe
runningsshfs-win svc
are exactly when you'd expect them to be.\\sshfs.r\username@computername
or\\sshfs\username@computername\somedir
sshfs-win.exe
,sshfs.exe
, and SSHFS'sssh.exe
runningsshfs-win svc
are exactly when you'd expect them to be.Workaround
sshfs-win
orsshfs
from command line