Friday, November 19, 2010

Changing the Default Port for Remote Desktop

Remote Desktop enables you to connect to your computer across the Internet from virtually any computer. By default, remote desktop connection uses the port 3389 to connect through which creates consistency between computers however, there are times when using a custom port number is required.

There is no facility for configuring which port settings Remote Desktop uses in Windows, which forces us to make the change manually in the Windows Registry using Regedit. Editing the registry can be harmful to your system so I recommend that you back up your registry before you begin.  Once you change the Remote Desktop default port, you will also need to allow the port through Windows Firewall and other firewall software packages. Read my instructions which detail how to add a Windows Firewall rule in Windows 7 or how to add a port to the Windows Firewall exception list in Windows XP when finished. Windows Firewall instructions Coming Soon!!

After backing up your registry, we will begin opening the Windows Registry Editor.

In Windows Vista and Windows 7: Click "Start" in the bottom left corner, then type "regedit" and press "Enter" or double-click the regedit shortcut at the top of the window listed under Programs.



In Windows XP: Click "Start" then click on "Run..." then in the Run dialog window, type "regedit" and press "Enter" or click "OK."



Once in the the registry the steps for Windows XP, Vista and 7 are the same.  The registry key which allows us to modify the default port for Remote Desktop Connection is located under HKEY_LOCAL_MACHINE



You'll need to navigate to HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber

To do this,
  • Double-click HKEY_LOCAL_MACHINE
  • Double-click SYSTEM
  • Double-click CurrentControlSet
  • Double-click Control
  • Scroll down to Terminal Server and then double-click
  • Double-click WinStations
  • Double-click RDP-Tcp



In the pane on the right side of the window, scroll down to "PortNumber" REG_DWORD which currently has a value of 0x00000d3d (3389). This is the key you need to edit.

Double-click on the "PortNumber" key.



In the Edit DWORD Value window, click the bubble next to "Decimal" to change to decimal editing. Now you can enter in the port number which you would like to use for Remote Desktop Connection.
*Refer to this list at Wikipedia for a list of common TCP and UDP port numbers.
When finished click "OK" and close the Registry Editor using the "X" in the top right corner.

Attention:
Make sure to create a Windows Firewall rule or exception when you are finished to complete the process in order to allow access to your system through a custom port using Remote Desktop Connection.

No comments:

Post a Comment