How to Change RDP Port Using Regedit
By default, Windows Remote Desktop Protocol (RDP) listens on port 3389. Modifying this default port via the Windows Registry Editor (Regedit) is a common practice to obscure the service from automated port scans and unauthorized access attempts. This guide provides a straightforward, step-by-step walkthrough to change the RDP listening port, configure the Windows Firewall to prevent lockout, and apply the new settings.
Step 1: Open the Registry Editor
- Press
Windows Key + Rto open the Run dialog. - Type
regeditand pressEnter. - If prompted by User Account Control (UAC), click Yes.
Step 2: Locate the RDP Port Registry Key
Navigate to the following registry subkey using the left navigation pane:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
Step 3: Modify the PortNumber Value
- In the right pane, find and double-click the DWORD value named PortNumber.
- In the edit window, change the Base option to Decimal.
- In the Value data field, enter your desired port number (choose an unused port between 1024 and 65535).
- Click OK to save the changes.
Step 4: Update the Windows Firewall
Before restarting the service, you must allow the new port through the Windows Firewall to avoid being locked out of the machine.
- Open the Start menu, search for Windows Defender Firewall with Advanced Security, and open it.
- Select Inbound Rules in the left pane and click New Rule⦠in the right pane.
- Choose Port and click Next.
- Select TCP, choose Specific local ports, and enter the new port number you configured in the registry. Click Next.
- Select Allow the connection and click Next.
- Ensure Domain, Private, and Public are checked (or according to your network requirements) and click Next.
- Provide a name for the rule (e.g., Custom RDP Port) and click Finish.
Step 5: Apply Changes
For the changes to take effect, you must restart the Remote Desktop service or reboot the computer.
To restart the service manually: 1. Press
Windows Key + R, type services.msc, and press
Enter. 2. Locate Remote Desktop Services
in the list. 3. Right-click the service and select
Restart.
Step 6: Connect Using the New Port
When connecting to the computer using the Remote Desktop Connection
client (mstsc), you must now specify the custom port by
appending a colon and the port number to the IP address or hostname:
192.168.1.100:3390 or computername:3390