Skip to content
Linux & server admin4 min read

How to Change SSH Port for Better Server Security (Step-by-Step Guide)

Learn how to change SSH port to protect your server from brute-force attacks. Simple, secure, and beginner-friendly guide.

How to Change SSH Port for Better Server Security (Step-by-Step Guide)

When you manage a server, security is not optional. One small misconfiguration can expose your system to automated attacks within minutes. This is why learning how to change SSH port is one of the first and most effective security steps every server owner should take.

By default, SSH runs on port 22. Hackers know this. Bots constantly scan the internet looking for servers with port 22 open. Changing your SSH port does not replace strong authentication, but it significantly reduces unnecessary attack attempts.

This guide explains everything in a simple and practical way. You will learn why SSH port changes matter, how to do it safely, and how Indian hosting infrastructure offers a reliable and cost-effective foundation for secure global deployments.

India has rapidly evolved into a strong hosting hub. Indian data centers now provide competitive global speeds, enterprise-grade security, and excellent scalability. For businesses serving Asia, Europe, or even North America, Indian servers offer low latency, strong compliance standards, and predictable performance at a lower operational cost.

If you manage a VPS, cloud server, or RDP hosted in India, learning to change SSH port correctly helps you build a more secure and resilient setup from day one.

How to Change SSH Port

Why Changing the SSH Port Matters

Changing the SSH port is not about hiding your server completely. It is about reducing exposure to automated attacks that target default configurations.

Most brute-force attacks rely on scanning port 22. When your SSH service runs on a custom port, these attacks usually skip your server entirely. This reduces server load, lowers risk, and keeps your logs clean.

Another benefit is control. When combined with firewall rules, key-based authentication, and limited user access, changing the SSH port becomes part of a layered security strategy.

For servers hosted in Indian data centers, this approach works extremely well. Indian hosting providers often offer fast provisioning, dedicated IPs, and configurable firewalls, which makes implementing SSH security changes smooth and reliable.

Step-by-Step Change SSH Port Tutorial (Linux Servers)

This change SSH port tutorial is written for beginners and works on most Linux distributions including Ubuntu, Debian, and CentOS.

First, connect to your server using your existing SSH access. Always keep this session open until you confirm the new port works.

Next, open the SSH configuration file using a text editor.

Shell
sudo nano /etc/ssh/sshd_config

Look for the line that says Port 22. Uncomment it if necessary and replace 22 with a custom port number. Choose a port above 1024 that is not used by other services.

Example:

Code
Port 2225

Save the file and exit the editor.

Before restarting SSH, update your firewall to allow the new port. If you are using UFW:

Shell
sudo ufw allow 2225/tcp

Now restart the SSH service:

Shell
sudo systemctl restart ssh

Open a new terminal window and test the connection using the new port:

Shell
ssh username@server-ip -p 2225

If the login works, you can safely close the old session.

This simple process dramatically reduces unauthorized access attempts while keeping your server fully functional.

Real-World Use Cases for Changing SSH Port

Changing SSH port is not just a technical best practice. It directly impacts real-world operations.

Developers running staging environments reduce automated login attempts by using non-standard ports. Agencies managing multiple client servers keep infrastructure safer by standardizing custom SSH ports.

Businesses hosting internal tools or CRMs reduce attack surface without adding complexity. Even freelancers managing personal projects benefit from quieter logs and improved peace of mind.

If you use RDP servers or VPS instances for remote work, changing SSH port helps maintain consistent access security, especially when paired with IP restrictions.

Scalability Options for Startups and Agencies

Scalability is where VPS hosting truly shines. You can start small and scale resources as traffic grows.

XenaxCloud offers flexible VPS plans that allow upgrades without downtime. For agencies managing multiple projects, higher-tier VPS plans like KVM VPS 3 or KVM VPS 4 provide enough CPU and RAM to handle concurrent workloads securely.

SSH customization, including port changes, scales with your infrastructure. Once configured properly, you can replicate secure setups across multiple servers easily.

Frequently Asked Questions

What is the difference between Indian VPS and foreign VPS?

Indian VPS offers lower latency in Asia, strong global connectivity, and cost efficiency while maintaining enterprise-level security.

Can Indian servers handle global website traffic?

Yes, Indian servers can efficiently serve global traffic when combined with optimized routing and CDN integration.

Is Indian hosting cost-effective for international users?

Indian hosting provides competitive performance at a lower operational cost compared to many foreign regions.

How reliable is XenaxCloud hosting?

XenaxCloud offers stable uptime, fast provisioning, and secure infrastructure backed by Indian data centers.

How to choose the right server for my business?

Choose based on traffic volume, resource needs, and scalability requirements, starting with VPS for flexibility.

Conclusion: Secure Your Server the Smart Way

Learning how to change SSH port is a simple but powerful step toward stronger server security. It reduces attack exposure, improves system stability, and supports long-term scalability.

When hosted on Indian infrastructure, this security practice becomes even more effective. Indian servers offer cost efficiency, reliable performance, and strong global connectivity, making them an excellent choice for businesses worldwide.

XenaxCloud combines these advantages with flexible VPS plans, transparent pricing, and a 15-day money-back guarantee. Whether you are a developer, startup, or agency, XenaxCloud helps you build secure and scalable hosting environments with confidence.

Start securing your server today with XenaxCloud VPS hosting.
Latest deals and discounts are always available on the XenaxCloud Offers Page: https://xenaxcloud.com/vps-server/

Akansha Soni
Written by

Akansha Soni

Part of the Xenax Cloud team — writing practical guides on hosting, servers and everything that keeps a website fast.