WSL2 openSUSE Tumbleweed ssh-agent

ssh-agent does not persist over sessions in WSL2 with current openSUSE Linux and other common distributions. Linux native bashrc solutions don’t work here.
Let’s use keychain instead

zypper in keychain

Then let’s add some snippet to .bashrc and remove any eval ssh-agent lines

vim .bashrc

# Once per key to load by default
/usr/bin/keychain -q --nogui $HOME/.ssh/id_rsa
/usr/bin/keychain -q --nogui $HOME/.ssh/

# Only once
source $HOME/.keychain/$HOST-sh

Then open a new window. It will ask you to enter your passphrase once. Enter any additional windows, it won’t ask you

Leave a Reply

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