Advanced

How to change the default SSH port on a Linux VPS

Posted by RoseHosting on · 7 comments
RoseHosting.com; By RoseHosting
Mail this story
Print this story

There are many ways to secure your Linux VPS. Changing the default SSH port from the default 22 to another one, is one of the first things you should do to secure your Linux VPS.

There are many ways to secure your Linux VPS. Changing the default SSH port from the default 22 to another one, is one of the first things you should do to secure your Linux VPS. One of the major benefits of changing the default SSH port is to avoid being scanned by the casual port scans. Thousands of brute-force logins are attempting to gain access to servers around the world trying to login to the default SSH port looking for weak passwords on the default accounts. Some of them will even try to use usual variants such as port 222 or 2222. If you change the SSH port to a random number, for example 2569, you will get rid of most of these annoying, and sometimes dangerous brute-force attacks.

In this article we will show you how to change the default SSH port, to strengthen the security of your Linux VPS.

Full Story

  Nav
» Read more about: Groups: Linux

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments (7)

Changing the port will not have any measurable increase in security.

However, porting knocking will increase security:

https://help.ubuntu.com/community/PortKnocking
I agree that ssh port changing may not increase one's security, but I can say that the savings in log "wear and tear" is significant. While running ssh on port 22 my logs filled with exploit attempts, and after changing to a random port the logged exploit attempts have literally gone to zero. A port change will discourage "script kiddies" but as you point out, dotmatrix, a port change will not deter a serious exploiter.

The best ssh security is still a strong password and/or a big certificate. I went to 4096 bit certs a couple years ago and expect that I should be safe for a few centuries at least.
I consider of interest the use of the iptables' xt_geoip module to limit world wide access to the server. There are obviously attackers from allowed countries, but still, global access can be denied. It can also filter out regions or cities in a country, I've not tried this latter option. But a serious attacker can try his luck through a VPN, I agree.
As soon as I confirmed an exploit, the process would spawn a shell script to add the source address to the iptables DROP list. Yes, the list could get long, but it didn't get saved on reboot. Plus, I could manually clear out the list anytime.

Caution: if you test such a technique from the host, you could effectively block your own network traffic (i.e. 127.0.0.1 packets get DROPped, not a good idea). Before you ask, uh, yeah, I learned that one the hard way. :(
Quoting:you could effectively block your own network traffic (i.e. 127.0.0.1 packets get DROPped


It might be embarrassing if you made a typo during your own remote login. I might be years before the next reboot. I suppose you could walk over to the neighbors and ask to use theirs in order to log in from a different IP address.
@dotmatrix, this was about 15 years ago. Fail2ban was still a couple years out from its first release.

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post