You have the opportunity to increase the security of your server by changing the default RDP (Remote Desktop Protocol) port in Windows. Using the default port 3389 can make it easier for attackers to discover your server and become a target for unauthorized access attempts. In this article, we will look at how to change the default RDP port to a more secure one.
Step 1: Check the current RDP port
Before changing the port, make sure you have access to the server via RDP and that the current port is 3389. Open the command prompt and run the following command:
bash
netstat -an | find "3389"
If the result shows that port 3389 is in use, it means that RDP is using the standard port.
Step 2: Open the Registry Editor
- Press
Win + Rto open the "Run" dialog. - Type
regeditand press Enter.
Step 3: Find the registry key for RDP
- Navigate to the following path in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp - Find the
PortNumberparameter on the right. This parameter contains the current RDP port. Remember or write it down.
Step 4: Change the RDP port
- Right-click on the
PortNumberparameter and select "Modify". - Change the value to the new port (e.g., 5000 or 6000). Ensure "Decimal" is selected as the base.
Step 5: Restart the RDP service
- Press
Win + R. - Type
services.mscand press Enter. - Find the "Remote Desktop Services" service and restart it.
Step 6: Check the new port
Now you can try connecting to the server using the new port. For example:
bash
mstsc.exe /v:your_server_ip:new_port
Replace your_server_ip with your server's actual IP address, and new_port with the port you chose.
Important notes:
- Ensure the port you choose is not used by other services and is not blocked by the firewall.
- Remember the new port, as you will use it to connect to the server.
Follow these steps carefully, and always back up the registry before making changes. Changing the RDP port can improve server security but requires attention.