SSH to WSL from terminal emulator

So, you have setup WSL ( Windows Subsystem for Linux) and are not happy with the “built in”emulator. In my case, I wanted to use an emulator and ssh to the Ubuntu in wsl2.
I hit a few road blocks, but here’s how one could get around them.
Install ssh
sudo apt install openssl openssh-server```
Windows will ask you whether you want to allow ssh through the firewall. Say yes.
#### Fix the configuration
Open the configuration file at `/etc/ssh/sshd_config` and do the following.
1. Change the port from `22` to `2222`. (or another one of your choice)
1. (optional) Make `key` authentication to `no` and password auth to `yes`
PubkeyAuthentication no
PasswordAuthentication yes```
Only if you haven’t setup the keys
Start the server
sudo service ssh --full-restart```
You might see that the (ssh) keys are missing, like below
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key```
If so, create the keys like below
Create the keys
ssh-keygen -A```
And restart the server once more (see above)
#### Good to go
Go to the terminal of your choice, and `ssh` to localhost.
ssh -p 2222 user@localhost```
It’ll ask for the password, and might be a bit slow to let you in.
Be patient, you will be rewarded.
Cheers, Sandeep.
About the author
We have other interesting reads
Cost-Efficient Kubernetes Setup in AWS using EKS with Karpenter and Fargate
Karpenter is an open-source Kubernetes cluster autoscaler designed to optimize the provisioning and scaling of compute resources.
How AI-Powered Fraud Detection Works: A Business Leader’s Guide
Understanding the technology that protects billions in transactions every day
Revolutionizing Kubernetes Configuration Management with KHook and KAgent: A Comprehensive Solution for Automated Nginx Troubleshooting and Remediation
Picture this: It’s 3 AM, and your phone is buzzing with alerts. Your nginx web server is crashing every few minutes, stuck in an endless restart loop. Your website is down, customers are frustrated, and you’re manually troubleshooting configuration issues that should be simple to fix
