I'm trying run the command ssh localhost but receive the error
ssh: connect to host localhost port 22: Connection refused
WhenI try to check the status of the SSH Server with the command sudo service ssh status I receive the error
- sshd is not running
I installed the SSH Client with sudo apt-get install openssh-client and the SSH Server with sudo apt-get install openssh-server ii. What else could the issue be thank you.
22 Answers
WSL does not automatically start sshd
Try removing the ssh server with:
sudo apt remove openssh-serverAnd then install it again with:
sudo apt install openssh-serverThen check the server status to see if it is running. If not, try:
sudo service ssh startto start the server. See more here
Hope this helps
wsl 2 now supports crontab
Add this to your crontab
@reboot sudo service ssh start