Use WSL keychain for key password in WSL terminal

Advertisement

SirWill
Joined:
Posts:
12

Use WSL keychain for key password in WSL terminal

Hey,

did anyone find a way to be able to use the keychain installed in WSL for the WinSCP SSH command?

I have tried multiple different commands and wasn't able to get it to work. Keychain would always ask for the password, except I manually run the ssh command inside wsl.

Asks for a password:
$ wsl ssh ..@..
---OR---
$ wsl /bin/bash -c 'cd ~ && eval "keychain --eval --agents ssh id_rsa" && ssh ...@...'
Doesn't ask for a password:
$ wsl
$ ssh ..@..

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,440
Location:
Prague, Czechia

Re: Use WSL keychain for key password in wsl terminal

I'm not sure what you ask for. Nor how is this released to WinSCP. Is this about WinSCP console window? Or what do you mean by "WinSCP ssh command"?

Reply with quote

SirWill
Joined:
Posts:
12

My goal was to no longer use PuTTY as an external terminal for WinSCP and instead the already existing tools Windows 11 has.

For the key storage, I was trying to use keychain instead of Pageant, which I couldn't get to work.

As WinSCP would still require Pageant, I then tried to get it to work with Pageant.
So now I'm using a bridge between Windows Pageant and WSL2 (https://github.com/BlackReloaded/wsl2-ssh-pageant) and
"%SystemRoot%\Sysnative\wsl.exe" sh -c ". ~/init.sh && ssh !U@!@ -p !# -t 'cd !/ ; /bin/bash'"
as terminal command.

This seems to work so far, but it's not the best solution as it still uses Pageant and using the Windows OpenSSH client would probably be even better (removing the overhead of WSL running).

Reply with quote

SirWill

Wouldn't a native Windows tool be the native Win32-OpenSSH, rather than WSL?
Yes, I didn't realize that Windows has OpenSSH without WSL at the time of writing.

Reply with quote

Advertisement

You can post new topics in this forum