Menu
Anti-random
  • Contact Us
Anti-random

File based SSH keys and agent forwarding in Windows and WSL

Posted on June 1, 2020September 29, 2022 by Sid

This is a follow-up to the hardware based SSH keys post, to document the reverse i.e. from hardware SSH keys to file-based SSH keys. File based SSH keys are weaker since they’re on your hard drive in the clear but they are also convenient.

Windows 10

  1. Disable automatic startup of start wsl-ssh-pagent.bat if you added that from the previous blog post.
    Start -> type ‘startup’ -> Startup Apps -> scroll to start wsl-ssh-pagent.bat -> Toggle off.
  2. You may need to update the OpenSSH binaries shipped in Windows 10 since even the Windows 10 v20.04 binaries can give an agent returned different signature type error sometimes.
    • Download and unzip the file from https://github.com/PowerShell/Win32-OpenSSH/releases. I used the OpenSSH-Win64.zip file.
    • Open an elevated PowerShell terminal by start -> type ‘powershell’ -> right click -> run as administrator
    • Navigate to the folder where you extracted the files above and install by running the script .\install-sshd.ps1
  3. Make sure you do NOT have the environment variable SSH_AUTH_SOCK defined. Type $env:SSH_AUTH_SOCK and hit enter in a powershell terminal. If it’s undefined, you should see no output, good!
  4. Hit Start -> type “services” -> scroll to “OpenSSH Authentication Agent”. It should have status “Running” and Startup type “Automatic”.

WSL (Windows Subsystem for Linux)

  1. Open a WSL terminal
  2. nano ~/.profile
  3. add { eval ssh-agent; ssh-add /path/to/my/key; } &>/dev/null at the end
  4. comment or remove export SSH_AUTH_SOCK=/mnt/c/tools/wsl-ssh-pageant/wsl-ssh-agent.sock (or similar) if you had previously added it

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Returning to social media, curated version!
  • How I got COVID-19 and beat it!
  • File based SSH keys and agent forwarding in Windows and WSL
  • Modern online safety for parents of young kids
  • SSH on Windows with private key on Yubikey

Recent Comments

  • Dirk Gently on Running Windows 10 on an older Macbook Pro
  • Hegi on SSH on Windows with private key on Yubikey
  • Robert on Running Windows 10 on an older Macbook Pro
  • Sid on Fix your CalSpa hot tub (error code SF)
  • Birat on Running Windows 10 on an older Macbook Pro

Archives

  • August 2021
  • June 2020
  • April 2020
  • March 2020
  • October 2019
  • March 2019
  • October 2018
  • November 2017
  • April 2017
  • January 2017
  • July 2016
  • January 2016
  • March 2015
  • January 2015
  • October 2014
  • February 2014
  • November 2013
  • September 2013
  • June 2013
  • May 2013
  • January 2013
  • December 2012
  • November 2012
  • September 2012
  • December 2011
  • November 2011

Categories

  • Business
  • Fitness
  • Fix it
  • Fun
  • Governance
  • IT
  • Living
  • Miscellaneous
  • Mobile
  • Parenting
  • Startups
  • Technology
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2026 Anti-random | Powered by Superb Themes