Change Windows VPS RDP port.
This article is based on Windows Server 2003 R2. Most of the steps should be similar for newer Windows Server versions.
Warning: Changing the default RDP port should be used as an addition to normal server security measures - not as an alternative.
Changing the default RDP port will require firewall and registry changes on the VPS, and changes to the RDP file configuration.
Warning: making these changes will prevent the default RDP file for your VPS(found in mPanel) from connecting to the VPS unless it is modified. If you are not sure you understand the changes being made, please back up your VPS first, or don't change anything.
Part 1. Configuring The RDP File
1.1 Log into mPanel and browse to the remote access page for the VPS. Download the RDP file for your VPS, saving with a file name which can be easily identified as a modified version. e.g. newrdpport.rdp
1.2 Locate the downloaded RDP file to used to log into the VPS, then right-click it and select Edit from the menu dialogue.
1.3 In the Computer: field enter the IP address of your VPS followed by a colon and the new RDP port number you will be using. e.g. 126.96.36.199:23654
1.4 Click the Save button in the 'Connection settings' section just below where you entered the VPS IP and new RDP port to use.
Part 2. Configuring the VPS Firewall
2.1 Open the Windows Firewall configuration dialogue on the VPS. Click the Start menu and go to Settings -> Control Panel -> Windows Firewall(usually the last Control Panel item).
2.2 Click the 'Exceptions' tab in the Windows Firewall window.
2.3 Click the 'Add Port' button to bring up a new configuration window.
2.4 Enter a name for the new firewall rule being created, and the same port number entered into your RDP file in Part 1.3 of the guide. Leave the default TCP option selected and click OK.
Name: Alternate RDP Port
Port Number: 23654
Note: If you will only be accessing your VPS from a static IP address(or addresses), you can add the IP address in the 'Change Scope' section using the 'Custom List' option for additional security.
2.5 Click the OK button to exit the Windows Firewall configuration and save the changes.
Part 3. Editing the Windows registry on the VPS
3.1 Open the registry editor on the VPS by clicking the Start menu, go to Run... and type in 'regedit' (without including the quotation marks) and click OK or hit the enter key.
3.2 In the registry editor, navigate to the registry key 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp'.
3.3 Scroll down the right side of the window and double-click 'PortNumber'.
3.4 Select the 'Decimal' option in the Edit DWORD Value' window.
3.5 Enter the same port number you chose as your new RDP port in Part 1.3 of the guide, then click OK.
Part 4. Testing the changes
4.1 Restart your VPS with the facilities provided in mPanel or from the Shut down menu on the VPS.
4.2 Once mPanel indicates the VPS is back online and responding to pings, double-click the RDP file previously edited in Part 1. of the guide. A security warning dialogue will open. Check the 'Don't ask me again for connections to this computer' box to prevent this popping up each time you want to connect to your VPS, then click Connect.
4.3 The VPS desktop login dialogue should appear if the change was successful. You should notice the port number in use is displayed in the window title. Enter your VPS login credentials and check your VPS' desktop is as you left it.
4.4 After successfully logging into the VPS using the new RDP port the default RDP firewall rule can be disabled(deselected) and the configuration saved by clicking OK.
4.5 The new configuration can be tested by attempting to connect to the VPS with the original(unmodified) RDP file. Attempting to connect to the VPS with the original RDP file should fail.