Report this

What is the reason for this report?

Ubuntu 12.04 changing default ssh port: connection refused

Posted on February 13, 2014

Hello,

I edited my /etc/ssh/sshd_config changing Port 22 to Port 1023. Restarted service and now I can’t connect.

Do I have to open port in firewall also? If so, how can I do this?

If I change back config to port 22 it works again.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Did you install a firewall on your droplet? What’s the output of <pre>sudo iptables-save</pre>?

A default install of Ubuntu 12.04.3 x64 doesn’t enable the firewall by default. However if you enabled it, yes you will need to open the port.
<br> <br>A simple way to open the port is with the ufw command, as root type: <br>ufw allow 1023/tcp <br> <br>To check the status of the firewall you can either of the following commands (as root): <br>ufw status <br>iptables -nL <br> <br>If your unable to access your VPS instance you will need to log into the portal, select the droplet and use the Console Access option.

I have this same problem, and it seems iptables -nL returns a line with: <br>… <br>ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 <br>… <br> <br>Do I need to update the iptables configuration to allow the new ssh port? <br> <br>From my mac osx client, I am not getting connection refused - I am getting a simple time out message: <br> <br>ssh: connect to host a.b.c.d port nnnnn: Operation timed out <br> <br>Any ideas? <br> <br>This is an Ubuntu droplet with ghost blog app chosen as setup time.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.