The default RDP port is 3389. Since this port is well known, it can be used to attack servers. To prevent this, we have to change the RDP port to something else.
Steps To Change The RDP Port
- Choosing A New Port Number.
- Adding The New Port Number To The Firewall To Accept The Connection.
- Changing The Port In The Windows Registry Setting.
- Connecting Through The New Port To Your Server.
Choose A New Port Number
The range between (0-1023) is for system ports and (1024-49151) is for user ports that have been given to the applications, so it’s better to choose an RDP port number between range (49152-65535), but it’s ok if you also find a free number between (1024-49151).
Note: In this topic, we have chosen port number 7952 as the new port.
Add The New Port Number To The Firewall To Accept The Connection
Now you should open your chosen port number in the Windows firewall to let the firewall accept that port’s connection.
You can use the below tutorial link to open a port in the Windows firewall.
Changing The Port In The Windows Registry Setting
Once you opened the port in the firewall, you should change the port number in the registry setting.
Open the RUN windows using Windows key + R, type Regedit, and click OK.
On the new window, navigate to the below path:
- Click on RDP-Tcp, find PortNumber on the right section, and double click on it.
In this section, put the Base on decimal and change the 3389 to your desired port number and click OK.
- Note: Close the registry and restart your server.The next time you connect to this server using the Remote Desktop connection, you must type the new port.
Note: If you faced any issue connecting to your RDP server, check the below link o find out the issue.
Also, you can check the below video to see how to change the RDP port.
It is essential to change the RDP port after you buy RDP to increase your connection to the server and prevent hackers from gaining unauthorized access to your server. Note that it’s vital to add the new port to the Windows firewall to prevent losing the server’s connection.