I often ssh into a remote machine. I am currently in a local library and when I try, I get the following message:

ssh: connect to host remote.machine.edu port 22: Connection refused

Is there anything I can do about this on my end or is it just something to do with the settings of the library's network?

I am using Ubuntu 16.04.


Assuming that the machine is not actually down:

The library's network blocks connections to TCP port 22 – its firewall generates a fake TCP RST to make it look as if the connection had been refused.

You might or might not be able to get around this by configuring another port number for the SSH server to listen on, but most likely, the library does the same for all ports except "normal" web browsing.

If that's the case, your only (technological) option is to use SSH over port 443 – either plain SSH (just changing the port or sslh), or SSH inside a TLS tunnel (stunnel/haproxy/etc), or SSH over Websocket, or outright a JavaScript-based web terminal.

  • Thank you. When I search about how to change the port, I see that I should edit /etc/ssh/sshd_config - but I only have ssh_config and not sshd_config. – user1551817 Jul 16 '19 at 13:12
  • Is this your own machine? When you connect (normally) to the server with ssh -v, what does it say next to "remote software version"? sshd_config is the correct file for OpenSSH, but it might be running other SSH software instead. – user1686 Jul 16 '19 at 13:19
  • Yes, I am ssh-ing from my laptop to a remote machine that I use often. Next to "remove software version" it says "OpenSSH_5.3" – user1551817 Jul 16 '19 at 13:22
  • That didn't really answer if you're SSH'ing to your own machine or not... But in any case, /etc/ssh/sshd_config is the standard location for OpenSSH unless the sysadmin installed a customized version. – user1686 Jul 17 '19 at 5:17

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.