Ubuntu – SSH refusing connection – “sshd: unrecognized service”


I am having an issue with SSH.

ssh: connect to host port 22: Connection refused

I get the above error whenever I try to connect my desktop with another desktop using SSH, but I'm able to ping the other desktop successfully.

ssh: connect to host port 22: Connection refused

When I attempt to restart sshd, it outputs the following error

sshd: unrecognized service

I can connect to remote server using SSH, but I'm not able to connect within the local network. How can I solve this issue?

Best Answer

Try un-installing and then installing openssh-server:

sudo apt-get remove openssh-client openssh-server

and then

sudo apt-get install openssh-client openssh-server

This worked for me. If you still can not connect, try

sudo ufw status verbose

and let us know what the output is.

Related Question