SSH Service says Active but Connection is Refused

Hi all,
I have a Raspberry Pi 2 with OSMC.
Here are my full logs:
http://paste.osmc.io/rutawehiji

My issue:
After reboot, if I go to OSMC > Services > SSH it’s says Active but I can’t connect (Connection Refused).
If I disable and then enable again through User Interface it’s accessible correctly.

Any clue or direction where I should look at?

Thanks for any help, tips or suggestion :slight_smile:

Have you made any changes to /etc/ssh/sshd_config?

I see that a public IP address was trying to bind to the SSH port. Do you have port-forwarding enabled on your router for port 22?

And the $64,000 question. Have you changed the default password?

Hi Flapflap,

Apr 27 21:50:02 osmc sshd[401]: error: Bind to port 22 on 90.127.15.196 failed: Cannot assign requested address.
Apr 27 21:50:02 osmc sshd[401]: error: Bind to port 22 on 192.168.1.13 failed: Cannot assign requested address.
Apr 27 21:50:02 osmc sshd[401]: Server listening on 127.0.0.1 port 22.
Apr 27 21:50:02 osmc sshd[401]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.

And

-rw-r--r--  1 root root   320 Sep 30  2014 openvpn.service
-rw-r--r--  1 root root   361 Sep 30  2014 openvpn@.service

You seem to have 2 openvpn systemd units enabled, you should only have one.

I would disable openvpn@.service

sudo systemctl disable openvpn@.service and reboot, I’m not sure if this will resolve your ssh issue; but it should help.

If you have any issues with your vpn after this (to be honest I would do this anyway):

Thanks Tom.

Tom, I think those are the files in /lib/systemd/system, not /etc/systemd/system.

Hi Dilthedog,

Maybe, but other logs I have been looking at recently only referenced (this is from memory mind) openvpn.service. But I could be completely wrong.

Regards Tom.

@dillthedog Apologies, I just checked another log I was looking at and your are correct.
@Flapflap Apologies, but I think my advise was way off the mark.

I don’t think I’ve touch the ssh default config.

Yes I add my public IP address pointing to my rasp pi but that was before the openvpn.
I plan to use my old rasp pi 1 as my server for public IP in a near future.

And yes I’ve changed the default pwd :slight_smile:

No worries! Thanks to have taken some time for me :slight_smile:

My bad. Yes I’ve changed it to allow the public IP binding!

suggest to provide output of:
cat /etc/ssh/sshd_config | paste-log
route
ifconfig
sudo netstat -tulnp | grep :22

So is it working again when you returned to default config?

Let me try :slight_smile:

Ok I kind of fucked up everything and add to re install the whole system :frowning:

Thanks for your help anyway ! I’ll see if the problem is still here after re install but should be ok.