[SECURITY ADVISORY] Beware of a Phishing Email Campaign Claiming to be from Truehost Cloud
India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Canada English
Canada Français
Somalia English
Netherlands Nederlands

How to change default SSH port on Linux

Build Something Beautiful

With a .cloud Domain

Just $4.80

  • Home
  • Blog
  • How to change default SSH port on Linux

Changing the default SSH port from the default 22 is one of the things you should do to secure your server.

The main benefit of changing the default port is to avoid being scanned by casual port scans.

Changing the default port to a random number get rid of some dangerous brute-force attacks.

  1. Login Via SSH

First you need to log in to your VPS via SSH. If the default port is 22 then you will not need to specify the port.

ssh root@IP_Address
  1. Update Packages

For CentOS

yum update -y

For Ubuntu

apt-get update $$ apt-get upgrade
  1. Open SSH Config File

Once the packages are updated, open the SSH configuration file with your favourite editor and find the line that specifies the SSH port

vim /etc/ssh/sshd_config
#Port 22
  1. Change port number

Uncomment the line by removing the # sign and change the default port 22 to one that you want to use.

Port 9845

Save changes and exit

NB:

Before changing the port, you should make sure that the new port is free and not used by any other service on your VPS.

You should also check that the port is not closed by your server’s firewall

  1. Restart SSH Service

For the changes to take effect, the service needs to be restarted

service sshd restart
  1. Check SSH port

Once restarted, SSH will listen on port 9845 .

This can be checked by running the following command

netstat -tunlp |grep ssh

Author

Read More Posts

the featured image of the ssl/tls certificate and the title mandatory tls

Why UAE Businesses Must Treat TLS as Mandatory in 2025

TLS isn’t just a technical checkbox anymore. For UAE businesses, it’s become a non-negotiable part of doing business…

The google gemini pro graphics and the title uae google partnership

UAE Google Partnership Unlocks Free Gemini Pro: Gateway to AI Learning

What if you could hire a personal tutor who never sleeps, speaks every language, and costs absolutely nothing?…

A laptop with its scren open on domains, a .zip graphic all in the background the truehost logo and title .zip domain phishing

.zip Domain Phishing Attacks Posing A Global Security Threat

.zip domain phishing has emerged as one of the most deceptive cybersecurity threats facing internet users worldwide. These…

A person rubbing off binary code from a white board and the title, is dns flushing safe?

Is It Safe to Flush DNS? A Complete Global Guide

Are you wondering if it’s safe to flush DNS on your computer? You’re not alone in this concern.…

DEAL! DEAL! DEAL! Get .TOP Domain Name @ $1.46REGISTER NOW