By default, Windows machines are remotely accessible via Remote Desktop on TCP port 3389. In certain situations changing the Remote Desktop, the port is useful, especially when you receive a huge number of failed Remote Desktop login attempts on the default port. In order to change the default port of Remote Desktop, you'll need to alter the registry of your server. Registry changes may cause some serious problems in your server when performed incorrectly, so be careful while performing the steps mentioned in this article.
Furthermore, to maintain access to your server after changing the Remote Desktop port, be sure that you also change the port in Windows Firewall's Remote Desktop Services rule OR create a new rule with a new RDP port by referring to this article. Otherwise, the Windows firewall won't allow you to access your server using the new Remote Desktop port.
- Log in to your Windows server via Remote Desktop.
- Click on Start >> Run >> Type REGEDIT and hit enter. This will open the registry editor.
- Locate and click the following registry subkey.
- Double click on the PortNumber registry subkey, select the Decimal base. Type a new port number in Value data field and click OK to save the changes. Here, we have entered 5253 as an example.
- Click on the close button located on the upper right side of the screen to close the registry editor.
- Again click on the Start button >> Run >> type services.msc and click on the OK button. The following window will be opened.
- Once you click on it, a new window will be opened with the name Services. Locate the Remote Desktop Service and click on the Restart the service link located on the left side of the services window.
- By clicking on it, a pop will be opened. In this window, you will get a message that when you will restart the Remote Desktop Service, the following service will also restart. Click on the Yes button to restart the Remote Desktop Service.
Note: Once you restart the Remote desktop service, the active remote desktop session will be stopped. You need to login into the VPS with a new port which you have set.
- Congratulations! you have successfully changed the RDP port to a non-standard port. That's all.