SSH client side connection error

Essentially I cannot connect to an SSH server anymore. Whenever I try to connect I get the following error:
ssh: connect to host HOSTNAME port 22: Connection refused

Note that I am able to connect from a different machine. Hence, the issue seems to be client side. Furthermore, I also cannot pull/push to git repositories that are cloned via ssh. Again, when pulling I get the following error:

ssh: connect to host port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists

It seems like I somehow nuked my SSH installations/config files. I have reinstalled SSH but this did not fix the problem. Any ideas?

That looks more like a connection error.

  • The computer where is does connect from, do you use hostname or IP address?
  • Can you ping the hostname/IP address you’re trying to connect to?

Enable more verbose output to see why connection is refused by the target.

1 Like

I am on eduroam. By adding the github host to the ssh config file I am able to pull from github now. But I am still unable to connect via SSH to my private server, even when using the -p 443 argument.

When running
ssh -p 443 -v
I get the following problem

kex_exchange_identification: Connection closed by remote host
Connection closed by port 443

Still looks like it could be a connection problem.

The port, 443, would need to be either

  • forwarded from a router to the server, making it possible to send data from external sources (like the internet) to the server, transparently through the router; or
  • the sever would need to be connected directly to the public network to be able to be accessed from an external source.

And then port 443 isn’t the standard SSH port, so that wouldn’t do anything except if the personal server is configured to use that port for SSH. AFAIK port 443 is for HTTPS by default, so this is a bad idea anyway.

So basically I’m very sad to say, that command doesn’t make sense on it’s own. Perhaps if there is proper context…and for that you’d have to give a lot more info. To that end, please see:

Hope you manage!

:bangbang: Tip: :bangbang:

To provide terminal output, copy the text you wish to share, and paste it here, surrounded by three (3) backticks, a.k.a grave accents. Like this:

pasted text

This will just cause it to be rendered like this:

Portaest sed
cursus nisl nisi
hendrerit ac quis
tortor sit leo commodo.

Instead of like this:

Portaest sed elementum cursus nisl nisi hendrerit ac quis sit adipiscing tortor sit leo commodo.

Alternatively, paste the text you wish to format as terminal output, select all pasted text, and click the </> button on the taskbar. This will indent the whole pasted section with one TAB, causing it to render the same way as described above.

Thereby improving legibility and making it much easier for those trying to be of assistance.

:bangbang: Also, if your language isn’t English, please prepend any and all terminal commands with LC_ALL=C. For example:

LC_ALL=C bluetoothctl

This will just cause the terminal output to be in English, making it easier to understand and debug.

I seems very likely the network you are using has restrictions.

The fact you can use 443 is because 443 is the SSL/TLS port for websites.

That is because your private server is still using port 22 - setting -p 443 is not a :magic_wand: it requires the remote to be configured for the port.

The IP does not appear to be github - so it is likely network restrictions


But an ssh service is answering

 $ ssh root@
The authenticity of host ' (' can't be established.
ED25519 key fingerprint is SHA256:rWD8I0za3Yv2tROUCtDp6LgFyp8UmsOhTvnyLUYp288.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '' (ED25519) to the list of known hosts.
root@'s password: 
Permission denied, please try again.
root@'s password: 

If this is your private ssh service - I strongly recommend you use the default config to prohibit root unless using keyfile


#PermitRootLogin prohibit-password

I am not sure what solution you suggest to fixing this issue. I have a hard time believing that “you cannot use SSH or github when in an eduroam environment” is the intended use.

In the eduroam network provided by my old university, everything is blocked expect http and https traffic over port 80 and 443.

Are you sure you are allowed to use SSH over port 22? You should contact the helpdesk of your eduroam network provider, which is often your university.

Also keep in mind that some eduroam networks are on ipv6 only. (at least in my country)

  1. you have a serious security issue if the ip you provided in this comment is in fact your own ssh

    • do not allow root to login using password
  2. contact your eduroam admin and verify if outgoing connection to port 22 is restricted

Thanks for letting me know. To be honest, no idea why that is. I have set the PermitRootLogin to no and restarted the service but this still remains.

I think, ssh may be configured correct

When you allow root-login only with key, ssh does this trick. I allows you to try endlessly all sorts of passwords. But you will never succeed :wink:

I do suggest to follow this advice :wink:

First on client side, then later may be also on server-side.