4

Yesterday I changed the default ports on the server from 22 to 1993 then restarted but now I can't connect at all.

I used

ssh -i keyname.pem ubuntu@remotehost

to connect then

sudo vi /etc/ssh/sshd_config

to change the ports. After that I restarted the server using

sudo service ssh restart

Now I can't connect at all, if I try

ssh -i keyname.pem ubuntu@remotehost

then I get this:

ssh: connect to host 12.34.5.678 port 22: Connection refused

if I try this

ssh -i keyname.pem -p 1993 ubuntu@remotehost

then I get this:

ssh: connect to host 12.34.5.678 port 1993: Operation timed out

I've tried

ssh -v user@host and that gives me this:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/macuser/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 12.34.5.678 [12.34.5.678] port 22.
debug1: connect to address 12.34.5.678 port 22: Connection refused
ssh: connect to host 12.34.5.678 port 22: Connection refused

I've also tried to connect using FileZilla and all I get with that is:

Status: Connecting to internal.livesite.com...
Response: fzSftp started
Command: keyfile "/Users/macuser/Desktop/secure_key"
Command: open "ubuntu@ remotehost" 22
Error: Connection refused
Error: Could not connect to server

If I just try to connect, but if I change the port to 1993 I get this:

Status: Connecting to internal.livesite.com:1993...
Response: fzSftp started
Command: keyfile "/Users/macuser/Desktop/secure_key"
Command: open "ubuntu@ remotehost" 1993
Error: Connection timed out
Error: Could not connect to server

I'm desperate to get this sorted as my boss wants to go through everything with me and I can't upload any changes until this is done. I'd be so grateful for any help.

11
  • 1
    Is there any firewall? (ufw, iptables) Is SSH (or something, at least) listening on port 1993? (netstat -nlt) Aug 6, 2014 at 13:17
  • I don't know if there's a firewall and don't know how to check. I only started int he job two weeks ago and have never done anything like this before (the job was advertised as HTML/PHP developer). If I open the Terminal what do I do to find out if there's a firewall?
    – Lucy
    Aug 6, 2014 at 13:20
  • Connection refused is the server rejecting the logon attempt. I think you've got the right IP and port - you just need to check whether the server you're connecting to is allowing your IP and/or user account to connect. The server you are connecting to, does your boss have a technical team who can assist?
    – Kinnectus
    Aug 6, 2014 at 13:26
  • No unfortunately there's nobody there to help, I'm the most technical person unfortunately
    – Lucy
    Aug 6, 2014 at 13:27
  • Do you have physical access to the server? Aug 6, 2014 at 13:29

2 Answers 2

3

First of all, once you change the port at the server you have connected with the -p switch.
As you are not able to connect even with the -p option, it is definetly an issue of the firewall.
Check if ufw is enabled in the server using ufw status.

If ufw is enabled in the server, try running

ufw allow 1993/tcp

on the server. This should work.

If your system does not have ufw, try disabling the firewall by flushing iptables and stoping the firewalld service.

0

see if your uncomplicated firewall is up

ufw status

if it is enabled, then you will need to allow yourself through the port

ufw enable 20

(replace the number with whatever port you need open) should be fine. Not many people use much outside of UFW as far as firewalls are concerned.

Ive seen people say you need to allow ssh through, I don't but maybe you do?

ufw enable ssh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .