How to Change SSH Port in Linux

Опубликовано: 26 Февраль 2026
на канале: CentLinux
363
like

Learn how to change SSH port in Linux with this step-by-step guide. Enhance your system's security by modifying the default SSH port for remote access.

Our Blog Post: https://centlinux.com/change-ssh-port...

My Go-To Tools for DevOps & Cloud:

Mini PC for homelab setups → https://amzn.to/45VyiNi
Hostinger VPS for cloud servers → https://www.hostg.xyz/SHHzp

Mini PCs are great for experimenting with Linux, Kubernetes, and Docker locally.
Hostinger VPS makes it easy to spin up affordable, reliable cloud environments.

Content Overview:

Changing the SSH port in Linux is a simple yet effective way to enhance your system's security by reducing the risk of automated attacks targeting the default port (22). The process involves modifying the SSH configuration file and restarting the SSH service.

First, locate the SSH configuration file, typically found at `/etc/ssh/sshd_config`. In this file, search for the line that specifies the port number (usually "Port 22") and change it to your desired custom port number. Be sure to choose a port that is not commonly used by other services to avoid conflicts.

After saving the changes, update your firewall rules to allow traffic on the new SSH port. This is important to ensure that your system continues to allow remote access over SSH. Once the firewall is configured, restart the SSH service to apply the new port settings.

Finally, when connecting to your server via SSH in the future, remember to specify the new port in your SSH command or client configuration. This small change adds an extra layer of security by making it harder for attackers to find your SSH service.

#centlinux #linux #sshd

Subscribe us for more Linux Tips & Tutorials, it is free:

Youtube:    / @centlinux  
Website: https://centlinux.com
Facebook:   / centlinux1  
Tumblr: https://www.tumblr.com/blog/centlinux
Linkedin:   / ahmer2023  
Instagram:   / centlinux21  
Pinterest:   / ahmer2023  

Disclosure:
Some of the links above are affiliate links, which means I may earn a small commission if you purchase through them — at no extra cost to you. This helps support the channel and future tutorials. Thanks!