4

I am using Pageant on my Windows machine to manage my SSH key. I have used ssh-agent before, but since Vagrant does not use ssh but net-ssh on vagrant up/provisioning I need to have my key in Pageant to use agent forwarding there.

I heavily use my ~/.ssh/config file to configure host shortcuts, keys they should use etc.

The .ppk file that pageant uses is not compatible with the ssh client, so I can not put it in the IdentifyFile directive.

I could, of course, let my ssh-agent run, too, but this kind of duplicates everything.

How do I combine pageant with my ssh client?

To clarify what I want to do:

  1. Add my SSH-Key to Pageant
  2. Configure user@myhost.com in the ~/.ssh/config as 'myhost'
Host myhost
    User calo
    Hostname myhost.com
    IdentityFile ~/.ssh/myhost
  1. Open up a git bash and type ssh myhost to connect to my host without having to put down my password again, because it would be taken from the pageant.
2
  • Pageant does not/cannot use the .ssh folder in any way. – Martin Prikryl Aug 18 '16 at 10:28
  • I do not want Pageant to use it. I want...I am going to clarify my question. Stay posted. – func0der Aug 18 '16 at 10:35
1

It can be done. You need to:

  1. create windows environment variable named GIT_SSH
  2. put the path to your plink.exe as value, for me it was:
    C:\Program Files\PuTTY\plink.exe
    
  3. logout & login (or restart your compouter)
  4. you should be done, you can confirm yourself you have set the variable right by git bash command:
    $ export
    
    (shows all env variables)
4
  • 3
    While this can be a useful information, it does not answer the question. -- How does this allow you to "use the ~/.ssh/config file with Pageant"? – Martin Prikryl Nov 5 '19 at 12:13
  • @MartinPrikryl did you read the whole description? The qeustion title is wrong, the question is inside in description "How do I combine pageant with my ssh client?", and I am exactly answering it – midlan Nov 5 '19 at 16:01
  • 1
    Yes I did. The question title is not wrong. The question explicitly says that OP "heavily use my ~/.ssh/config file to configure host shortcuts, keys they should use etc." - Your answer does not allow that. – Martin Prikryl Nov 5 '19 at 16:08
  • 1
    The ~/.ssh/config works in git bash ssh agent by default. I assume the IdentityFile is ignored when using ssh agent. (can't confirm now, I am using single key and I don't fill the IdentityFile option) – midlan Nov 6 '19 at 19:02
0

.ppk files can be easily converted to OpenSSH format using PuTTYgen's "Export" feature.

That would be your best option, considering that OpenSSH's ssh program does not speak the Pageant protocol (nor vice versa). Only PuTTY's plink, psftp, &c. can use Pageant.

In PuTTY though, similar configuration could be done by saving a 'session' in PuTTY's GUI.

3
  • Which would not help me with stuff like vagrant though, which uses ssh-agent for agent forwading. :/ And the simple truth is: I do not want to use PuTTY as my SSH client. – func0der Aug 18 '16 at 14:12
  • 1
    Then don't use PuTTY! Like I said, you can convert the key to OpenSSH format, for loading into ssh-agent. – user1686 Aug 19 '16 at 18:47
  • You do not get that I do not have NO choice here. If I would, I'd use ssh-agent on a Linux machine, but the fact that I do not made me open this question. I know, I could use both, but as I said, I want to keep it "simple". Single point of storage in this case. – func0der Aug 22 '16 at 9:37
0

I'm not sure this will solve your use case but using a PuTTY session worked for me in my scenario when using Mercurial.

Before: I have a working Pageant with a working ssh key and I clone from myhost using

hg clone ssh://calo@myhost//home/hg/repo

After:

hg clone ssh://host_hg//home/hg/repo

To accomplish this I created a saved session in PuTTY called host_hg where I set the "Auto-login username" to calo. You can create a new session by right-clicking the Pageant icon in the toolbar and select "New Session". Enter the Host Name and Saved Sessions name. You'll find the field "Auto-login username" in the left tree under "Connection->Data". Don't forget to Save the session.

I guess the equivalent of IdentityFile is "Private key file for authentication" found under Connection->SSH->Auth.

0

The usage of https://github.com/benpye/wsl-ssh-pageant solves this.

Add

IdentityAgent SSH_AUTH_SOCK

to your .ssh/config

Add the user environment variable via windows setting: Name: SSH_AUTH_SOCK Value: \.\pipe\ssh-pageant

Start: wsl-ssh-pageant.exe --winssh ssh-pageant

Now you can login in to your host via ssh in commandshell or powershell. Of cousre pageant must be running with keys already.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.