How to change RDP port in windows

How to change RDP port in windows

The default RDP port is 3389. Since this port is well known and can be used to attack servers, it’s better to be changed.
Here are the steps to change the port:

  • Choosing a new port number.
  • Adding the new port number to the firewall in order to accept the connection.
  • Changing the port in a windows registry setting.
  • Connecting through the new port to your server.
  1. Choosing 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.

     

  2. Adding the new port number to the firewall in order to accept the connection:

    Now you should open your chosen port number in the Windows firewall in order to let the firewall accept the connection from that port.
    This section has been completely explained on OPEN A PORT topic.

     

  3. Changing the port in a 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:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

    RDP port
    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.
    port
    Note: Close the registry and restart your server..

    The next time you connect to this server by using the Remote Desktop connection, you must type the new port.

    Number

About the Author

Leave a Reply

seven + 13 =