SSH refusing connection - "sshd: unrecognized service"

I am having an issue with SSH.

ssh: connect to host 192.168.1.7 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 192.168.1.7 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?


Solution 1:

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.

Solution 2:

First make sure that ssh service running on 192.168.1.7 or not..it is possible that system doesn't have an SSH daemon, so you need to install ssh on that system.

sudo apt-get install openssh-server

If it's already installed, run sudo service ssh restart, then comment here with the output of this command from both the systems.