-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use PuTTY Pageant (or KiTTY Kageant) for encrypted SSH keys #267
Comments
As a workaround for the issue above, translate your call of
to the equivalent
That's it! |
Thank you for working on this and figuring out a solution. The reason that Perhaps a better approach would be to copy the environment from Windows and just overwrite |
You're welcome!
I see - this will be this, I guess: But is that working, though? What we discuss around #95 (comment) suggests that for some reason,
I think just leaving the environment untouched (that is, passing down the original caller's environment using |
@bersbersbers please try the latest beta release where I implemented your suggestions:
Please try the latest beta from https://github.com/billziss-gh/sshfs-win/releases and let me know if this works for you. Thanks. |
@billziss-gh 2021.1 seems to be working fine, thank you! I was able to remove |
Excellent. Hopefully these changes (esp. the |
I also installed 2021.1 and it seems Putty Pageant + ssh-agent.exe are working when running sshfs-win.exe directly. @billziss-gh Would it be possible to bundle the ssh-pageant.exe with the sshfs-win package to make things easier? |
@breisig including ssh-pageant is certainly possible, because it is a Cygwin package. However I am not familiar with the program's operation, because I do not use it. Is it sufficient to just include the program in the EDIT: On further investigation ssh-pageant appears to be a Cygwin daemon. So I am uncertain whether it could be made to work with SSHFS-Win without issues in some cases, unless we run it as a Windows service. However this feels beyond the scope of SSHFS-Win, which purports to be a simple and standalone file system solution. |
@billziss-gh the steps I outline above are really all it takes (on my system at least). I see two ways:
Maybe (Either way, please note that my issue is solved, and further integration of |
Is their a way to use this with 'net use'? |
@breisig in principle it should, yes. After all, I did not change my calls to sshfs-win.exe, so it should not matter whether I call it or it's called from net use. Of course, for permanent connections to be recreated after reboot, you need to make sure that pageant and ssh-pageant are running before net use tries to reconnect. That seems hard to ensure, particularly if your SSH keys are encrypted and you need to enter a password into pageant. So for me, there is no added benefit to using net use over sshfs-win.exe. |
The latest putty agent listen to a proper named pipe. There is no need for ssh-pageant at all. |
@131 oh? |
In the "snapshot" release of puttyagent (0.74+). Putty agent now listen to a named pipe |
Interesting. I am a bit skeptical this is/will shortly be available in stable build because
This is certainly valuable for development, but I would not bet on this being able to replace |
If this is all true, I would be interested in installing a test pageant build with the instructions for setup the named pipe [assuming something like to set SSH_AUTH_SOCK=\.\pipe\ssh-pageant or whatever the pipe name is ] running the latest test pageant build to see if it works. I know in Windows you can see all the named pipes but running the following in powershell: [System.IO.Directory]::GetFiles("\.\pipe\") |
@bersbersbers @131 When running it, I noticed that the new version does initiates a named pipe. It seems to be dynamic as it changes whenever I reboot my computer. [Couldn't find out how to permanent set the named pipe]. Even so, it didn't seem to work for me. Here's what I did.
Changed my local User environment variable to match it.
|
@breisig thanks for trying! I don't see anything wrong with what you do, but I have never used named pipes myself. either. What you are assuming, however (pointing out the obvious, maybe), is that
What you might try:
|
I’m using npiperelay in wsl to access the windows named pipe in WSL (it is a totally different use case, but it might help you understand what is missing here) https://stuartleeks.com/posts/wsl-ssh-key-forward-to-windows/ |
Speaking of WSL, there is also https://github.com/benpye/wsl-ssh-pageant which could be used as another tool to try related use cases. I am not using |
This is a completely fascinating thread to read, but since I'm not that familiar with windows internals I now have a headache. Could anyone be so kind to, assuming the latest version of pageant is running with a valid ssh-key, properly installed on the server, explains how to connect to the remote server with SSHFS? A batch file example would be great. Ideally somebody writes a frontend which
But currently it's still a work in progress with lots of loose parts of people who have great intentions but don't see the bigger picture, namely to get one easy to use unified secure network file system. |
@hboetes are you aware of https://github.com/evsar3/sshfs-win-manager? |
Absolutely, it looks nice, but it stores password in cleartext, or uses unencrypted ssh-keys. I already put out a feature request to amend those problems. I don't want to nag, but do you have an answer to this question?
|
If you are looking here, you are looking in the wrong place in my opinion. Points 1-5 in your list in #267 (comment) have nothing to do with SSHFS specifically, but about setting up certificate-based SSH access to your server. If that is possible at all depends a lot on the SSH server configuration (especially thinking about 2FA, for example). I am not sure sshfs-win should can or should cover all these possible cases. Edit: By the way, this very issue has a couple of examples (e.g., #267 (comment)) on how to connect. |
Much appreciated. Thanks for the heads-up. |
Using
But the Windows OpenSSH
And all Windows OpenSSH
|
Is this issue suppose to be closed? As of right now doing |
This started months ago at #217 (comment), and I have finally found the core issue and a potential solution (as well as a workaround, see next comment).
Get
ssh-pageant.exe
, e.g., from https://github.com/cuviper/ssh-pageant/releases/tag/v1.4-prebuilt-cygwin64.I got mine, version 1.4, from Cygwin:
https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86_64%2Fssh-pageant%2Fssh-pageant-1.4-1&grep=ssh-pageant
Launch PuTTY's
pageant
or KiTTY'skageant
and load your key(s). Then, startssh-pageant
like this:Ideally, this should be it - fire up
sshfs-win.exe
from a shell whereSSH_AUTH_SOCK
is set correctly (you can usesetx SSH_AUTH_SOCK %TEMP%\ssh-pageant.socket
once to set it globally once and forever, and auto-startssh-pageant.exe
on login) and you should be good.Unfortunately, it seems that the value of
SSH_AUTH_SOCK
is lost whensshfs-win.exe
callsssh.exe
throughsshfs.exe
. I suspect the problem to be here:https://github.com/billziss-gh/sshfs-win/blob/bb6c90d35cfb309cf976794a7f12938f1ebee136/sshfs-win.c#L248
(Note:
sshfs
usesexecvp(sshfs.ssh_args.argv[0], sshfs.ssh_args.argv)
instead, see https://github.com/libfuse/sshfs/blob/9e01ffd161591f87dd7ef02ab2a0f0aecd800a00/sshfs.c#L1225,which does not have this problem as we will see.)
The text was updated successfully, but these errors were encountered: