🕒 Reading Time: 2 minutes

It is common to servers are remotely accessible via the TCP 3389 port (default port). In some situations, when a more secure environment is needed, changing the remote access port can be useful. This article explains how to change the RDP port on a Windows and Linux servers.

To change RDP port on a Windows Server follow the next steps:

WARNING: Be careful when making changes to the Windows Registry as it contains critical configuration settings for your operating system. 1. The instructions below apply to machines running Windows Server 2012, 2008 R2, 2008, and 2003. Please follow the below steps to change the RDP port: 2. Connect to the server via Remote Desktop 3. Click simultaneously on the Windows logo + R to open the “Run” dialog 4. Open the registry editor by typing the “regedit” command 5. Search for this registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber 6. Double-click or right-click on the “PortNumber” registry subkey, select the decimal base and type the port number of your choice (the default port is 3389, in this example, the selected port is 3312). Click on “OK” to save the selection.

IMPORTANT: Make sure that remote access to your server through the new port is authorized in your Windows firewall before executing the next step.

7. Exit the registry editor 8. Restart your server After the reboot, specify the Remote Desktop port number.

To change the SSH Port for Your Linux Server Server follows the next steps:

You can change the default SSH port for your Linux server as an added security measure.

WARNING: Make sure the new SSH port does not conflict with any known or blocked ports.

1. Connect to your server via SSH 2. Switch to the root user 3. Run the following command:
vi /etc/ssh/sshd_config
4. Locate the following line:
# Port 22
5. Remove # and change 22 to your desired port number. 6. Restart the sshd service by running the following command:
service sshd restart
ready you have now a more secure environment