hosting image
How To Change Connection Port On Linux VPS

How To Change Connection Port On Linux VPS

When communicating with other devices, Linux Virtual Private Servers (VPS) make use of a certain collection of connection ports by default. But, if you need to get past port blocking or want to make your VPS more secure, altering the connection port might be useful. In this post, we will walk you through the process of changing the connection port on a Linux virtual private server (VPS) in a step-by-step manner.

Step 1: Connect to the VPS

To change the connection port, you must first connect to the VPS using SSH or any other remote access method.


change linux password

Step 2: Access the SSH Configuration File

Once you’re connected to the VPS, use the following command to get to the SSH configuration file:

sudo nano /etc/ssh/sshd_config

change port on linux

Step 3: Locate the Port Line

In the configuration file, locate the line that specifies the port number used by SSH. By default, the port number is set to 22.

change port on linux

Step 4: Change the Port Number

To change the port number, replace the default port number with the new port number. Choose a port number between 1024 and 65535 that is not already in use. For example, you can set the port number to 2222.

change port on linux

Step 5: Save the Changes

Once you have changed the port number, save the changes to the configuration file by pressing “Ctrl + X,”  then “Y,”  and finally “Enter.”

See also  Is RDP exclusive to Windows?

Step 6: Restart the SSH Service

To apply the changes, you must restart the SSH service by running the following command:

sudo systemctl restart sshd

change port on linux

Step 7: Verify the Changes

After restarting the SSH service, connect to the VPS using the new port number to make sure the changes worked. You can do this by specifying the new port number in the remote access client when connecting to the VPS.

Buy Linux VPS now! Securely change connection port for optimal performance.


Changing the connection port on a Linux VPS can help make it safer and stop ports from being blocked. Changing the connection port on your Linux VPS is easy if you follow the step-by-step instructions in this article. It’s important to remember to restart the SSH service after making changes to ensure that the changes are applied successfully.


4/5 - (1 vote)


  • I?¦ve recently started a website, the info you provide on this website has helped me greatly. Thank you for all of your time & work.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Setup Your Server