How to Change SSH Ports in VPS India?

7 mins read
VPS India
VPS India


Securing your VPS server India is crucial, and one effective way to enhance its security is by changing the default SSH port. In this guide, we will walk you through the steps to change your SSH port, ensuring a more secure environment for your VPS India. We’ll explore the process, step by step, providing you with a comprehensive understanding of the topic.

How To Choose an SSH Port For Your VPS India?

Before we delve into the technical steps, it’s essential to choose an appropriate SSH port for your VPS in India. The default SSH port is 22, but changing it to a non-standard port adds an extra layer of security to your server. While you can technically select any available port, it’s wise to choose one that is not in common use to minimize the risk of automated attacks.

Here are some tips to consider when selecting an SSH port:

  • Avoid well-known ports: Refrain from using commonly used ports to reduce the likelihood of unwanted attention from attackers. Ports below 1024 are generally reserved, so opt for a higher number.
  • Choose a number between 1024 and 49151: This range includes unprivileged ports, which are ideal for SSH.
  • Randomize the port: Consider using a port that is not easily guessable, making it even more challenging for potential threats.

How To Change The Current SSH In India VPS Servers?

Now, let’s move on to the practical steps of changing the SSH port on your VPS in India.

1. Connect To The Server Through SSH

Before embarking on the process of changing the SSH port, it is essential to establish an initial SSH connection to your VPS India. You can do this using the default SSH port, which is 22, and the server’s IP address. To ensure a secure connection, make use of a trusted and secure terminal client like PuTTY (for Windows users) or Terminal (for Linux and Unix users).

Example command:

ssh username@your_server_ip -p 22 

By executing this command, you gain access to your server through the default port, providing a point of entry for the subsequent port modification process.

2. Change Configurations Of SSH

a. After successfully connecting to your VPS India server, you need to edit the SSH configuration file. This file houses the settings for your SSH server and allows you to modify its properties. For text editing, you can employ popular text editors like Nano or Vim.

Example using nano:

sudo nano /etc/ssh/sshd_config 

b. Within the SSH configuration file, locate the line that specifies the SSH port. This line typically appears as follows:

Port 22 

c. To change the port number to your desired one, such as 2222, edit it as follows:

Port 2222 

d. After making this change, be sure to save the modified configuration file and then exit the text editor.

3. Configure Firewall In Your India VPS Server

a. If your VPS India employs a firewall, such as the Uncomplicated Firewall (UFW), it’s crucial to update its settings to allow incoming traffic on the new SSH port (2222 in our example). The firewall acts as a barrier that manages and controls network traffic, ensuring only authorized connections are permitted.

Example using UFW:

sudo ufw allow 2222/tcp 

b. Following this, you must reload the firewall to ensure that the changes are applied effectively:

sudo ufw reload 

Configuring the firewall is an integral part of the process, as it authorizes access to your VPS hosting India through the newly chosen SSH port while still maintaining security by blocking any unauthorized access.

4. Test The New SSH Port

a. Before concluding the procedure, it’s essential to verify that the new SSH port (in this case, 2222) is configured correctly and allows you to establish a secure connection. To do this, open a new terminal window without closing your existing SSH session and attempt to connect to your server using the newly set port.

Example command:

ssh username@your_server_ip -p 2222 

b. If everything is correctly configured, you should be able to log in to your India VPS server without any issues. However, if you encounter any problems or difficulties, the default SSH port (22) will still be active and accessible, enabling you to address and rectify any potential issues with your new port configuration.

By following these comprehensive steps, you can successfully change the SSH port on your VPS India. This practice significantly enhances the security of your server by reducing the vulnerability to automated attacks and unauthorized access. It is a fundamental aspect of maintaining a secure and well-managed VPS environment.


Changing the SSH port on your VPS in India is a simple yet effective security measure to protect your server from automated attacks and enhance its overall security. By selecting a non-standard port and following the steps outlined in this guide, you can significantly reduce the risk of unauthorized access to your server.

For optimal results, consider implementing additional security measures, such as disabling root login, using key-based authentication, and regularly updating your server’s software.

We would also like to mention Serverwala Cloud Data Centers, a reliable provider of VPS India hosting services. Serverwala’s state-of-the-art data centers and top-notch customer support make them an excellent choice for hosting your VPS server India. Their commitment to data security and performance aligns perfectly with the security enhancements you’ve learned about in this guide.

In the end, one can infer that the process of changing your SSH port is a fundamental step towards a more secure VPS environment. Remember that security is an ongoing process, and regularly monitoring and updating your server’s configurations is essential to stay protected. With these measures in place, you can ensure the safety and reliability of your VPS hosting India.

Leave a Reply

Your email address will not be published.

Follow Us