Skip to the content
Cloudfanatic Knowledge baseCloudfanatic Knowledge base
  • Home
  • Log In
  • System Status
  • Home
  • Log In
  • System Status

How can we help?

e.g. ssh keys, set up mysql, ubuntu 22 mysql php nginx, account settings

Account Functions

  • Your Dashboard
  • Accessing your server for the first time
  • Controlling you instance
  • Cloudfanatic Operating systems and Rebuilding your instance
  • DNS Manager
  • Custom ISO images

Sales & Billing

  • Cloudfanatic Crypto Payments
  • Frequently Asked Questions (FAQ)
  • Server billing
  • Automatic billing for your account
  • Server Upgrades
  • Cloudfanatic Affiliate Program
  • Automated Server backups

News & Announcements

  • RockyLinux 9 now generally available for all instances
  • AlmaLinux 9 now generally available for all instances
  • Servercheap is now Cloudfanatic and more news
  • Ubuntu 22 now generally available for all instances
  • Cloudfanatic/Servercheap has been featured on HostAdvice
  • New 1-Click App – CyberPanel
  • New location: North Carolina
  • Cloudfanatic/Servercheap has been featured on Hostingadvice.com
  • Centos Stream now generally available for all instances
  • Cloudfanatic receives an additional new direct IP allocation from ARIN
  • Cloudfanatic is Introducing 1-Click Apps

Tutorials

  • Secure Apache with Let’s Encrypt on Ubuntu 22.04
  • Setup Apache and Virtual Hosts on Ubuntu 22
  • Change SSH Port on Almalinux
  • Change SSH Port on Debian 10/11
  • Change SSH Port on Ubuntu 20/22
  • Firewalld Cheat Sheet
  • Ubuntu UFW Cheat sheet
  • How to copy my files to and from a linux vps
  • Create passwordless login with SSH keys and PUTTY
  • Accessing your server for the first time
  • DNS Manager
  • Controlling you instance
  • Home
  • Docs
  • Tutorials
  • Change SSH Port on Almalinux

Change SSH Port on Almalinux

Table of Contents
  • Overview
  • Changing the SSH Port:
  • Allow your new SSH port through SELinux
  • Allow your new SSH port through firewalld
  • Restart SSHd

Overview #

In this short tutorial you will learn how to change your SSH port from the default 22 to another port. This is a recommended step during any initial server hardening. Cloudfanatic’s Almalinux 9 comes with SELinux set to enforcing by default and firewalld active.

Instructions for Debian

Instructions for Ubuntu

Changing the SSH Port: #

Edit your ssh configuration file:

nano /etc/ssh/sshd_config
  • Find line: #Port 22
  • Uncomment the line
  • Change 22 to your desired port number
  • Save the file

Allow your new SSH port through SELinux #

yum -y install policycoreutils-python-utils
semanage port -a -t ssh_port_t -p tcp 12345

where 12345 is your new SSH Port.

Allow your new SSH port through firewalld #

firewall-cmd --add-port=12345/tcp --permanent
firewall-cmd --reload

Restart SSHd #

systemctl restart sshd

That should be all. Try and ssh into your server on your new port.

What are your Feelings
Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on November 1, 2022
Setup Apache and Virtual Hosts on Ubuntu 22Change SSH Port on Debian 10/11

Powered by BetterDocs

Table of Contents
  • Overview
  • Changing the SSH Port:
  • Allow your new SSH port through SELinux
  • Allow your new SSH port through firewalld
  • Restart SSHd

2023 Cloudfanatic Knowledge base

To the top ↑ Up ↑