Search code examples
linuxsshraspberry-piraspbian

Raspberry Pi - suddenly no SSH access


Today I've noticed I can't connect to my raspi anymore using SSH with "Connection refused" or "...actively refused". It's extremely strange as far as until now, for a long time there was no problem accessing it through SSH. My raspi is actually running on wifi, I can ping it, I can HTTP access it, all the services seem to be running (I've got a streaming server on, PHP, apache, mysql - everything ok). I also have several config scripts reachable by HTTP requests, which are working normally. I have created a new set of ssh keys using

sudo dpkg-reconfigure ssh-server

then disabled and enabled ssh again via raspi-config, but nothing seems to work. Strange thing I've also noticed, that overnight, my router appended another IP address to my pi for some reason (despite that my IP lease time is set to forever on my wifi router), but I have no clue how this could affect my SSH access (maybe someone has some idea...?).

Important thing of this case is, that even if I try to locally (hdmi, keyboard, mouse) execute

 ssh pi@raspberrypi 

I still get "connection refused on port 22", I have no firewall and no other security stuff enabled and my router is set to forward SSH.

Actually, I can only access my raspi locally, not via network. I'm completely stuck. Any ideas? Tks.


Solution

  • On some systems the package ssh-server is called openssh-server.

    sudo apt-get purge openssh-server
    

    uninstall with purge, and:

    sudo apt-get install openssh-server
    

    The purge is to remove config files that may be broke.