3

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.

2
  • 1
    @user68186 Thank you that fixed it the sshd is now running. Aug 5, 2020 at 21:43
  • I have converted my comment to an answer. Please accept the answer below by clicking on the gray check mark ✔next to it and turn it green ✅. This will indicate that the answer is correct and help others with the same problem. You can also up-vote my answer to show your appreciation.
    – user68186
    Aug 17, 2020 at 21:13

2 Answers 2

5

WSL does not automatically start sshd

Try removing the ssh server with:

sudo apt remove openssh-server

And then install it again with:

sudo apt install openssh-server

Then check the server status to see if it is running. If not, try:

sudo service ssh start

to start the server. See more here

Hope this helps

0

wsl 2 now supports crontab
Add this to your crontab

@reboot sudo service ssh start

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .