1

I am having issue where I can't SSH to my server. I was having a look at some logs on the server, finished and just closed the connection. As soon as I tried connecting again I got the message: ssh: connect to host SERVERIP port 22: Connection refused.

Here is the debug log:

XXXXX:~ XXXXXX$ ssh -vvvv XXXXX@serverip
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to SERVERIP [SERVERIP] port 22.
debug1: connect to address SERVERIP port 22: Connection refused
ssh: connect to host SERVERIP port 22: Connection refused

I can see it refers to line 21 but nothing was changed in the config file, any idea what is causing this?

1

Connection refused is a generic socket/service related error, it is typically shown when establishing a socket where the remote endpoint has no listener on the desired port.

In this case the remote server must not have the ssh daemon running, so does not have anything listening on port 22 (presumably), or a highly unlikely possibility is that the ssh daemon itself is having issues.

So make sure the ssh daemon is running (and functioning properly) on remote host you are trying to connect to.

2
  • yep that is also something i noticed when i was on server earlier, the status of ssh was "stop/waiting". this is vps so i dont have any other access than ssh to it. would restarting the server maybe solve it? – Jan Peeter Oct 24 '16 at 15:16
  • 1
    @StephanGriesel Don't they provide any console? If the ssh service is set to be started at system boot (and you have no other way to get in and start the daemon), then restarting would definitely work. – heemayl Oct 24 '16 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.