- Having lots of fun testing ngrok. As of today, here’s how I was able to get ngrok working with ssh from macOS to WSL (DISCLAIMER: Step 3 may not be kosher :-) ! The following is unsupported and use at your own risk! Please be careful!):
- 0. Start the ssh service in WSL e.g. on ubuntu
sudo systemctl enable ssh
- 1. Generate an SSH Key on your mac (I used the github directions:Generating a new SSH key and adding it to the ssh-agent and of course used
*.tcp.ngrok.io
instead of *.github.com
), let’s call it wsl2
. This key must have a passphrase or it won’t work.
- 2. Copy the public key to the WSL machine e.g. using
croc
croc ~/.ssh/wsl2.pub
- 3. Rename the nologin file to allow logins to WSL (Otherwise ssh will fail with a
pam_nologin
error):
sudo mv /var/run/nologin /var/run/2023-01-31-renamed-nologin
- 4. start ngrok
ngrok tcp 22
- 5. SSH in e.g.
ssh -i ~/.ssh/wsl2.pub roland@somehost.tcp.ngrok.io -p <someport>
Previously
Leave a comment on github