Step-by-Step: Remote Desktop - Changing the Port Number (for security and multiple hosts)
August 29, 2004

In this guide, I'll show you how to change the port number that Remote Desktop uses.  Why would you want to do this? 

1.  For security purposes.  The standard port of 3389 that Remote Desktop uses is very well known which makes it a potential target for hackers.

2.  To allow multiple computers to run Remote Desktop Hosts from behind a router.  Since only one computer can use a given port number at anytime, we can give each computer that runs Remote Desktop Hosts a different port number so each one can be used remotely.  Otherwise, with just the standard port number of 3389, you would be able to connect to only one computer.  We can give Computer 1 port 4000, Computer 2 port 4001, and forward the appropriate ports to the correct computers.  Now you can connect to many computers behind one router, not just one.

Before we start, we have to deal with a few things.  First, each computer on your computer that you plan on using as a Remote Desktop Host must have a STATIC local IP address, assuming that you're behind a router.

In this example, we'll pretend that we have 3 computers behind a router that are running Windows XP Pro with Remote Desktop Hosts.  We'll configure it so that each computer will run Remote Desktop Hosts on a different port number.

Computer 1
Port: 4000

Computer 2
Port: 4001

Computer 3
Port: 4002

We're gonna have to mess with the Registry of Windows, which means that you should first back it up and be really careful with the changes you make.  The Registry is a pain in the butt to work with so make sure you are extra vigilant with any changes you make.

On the computer used as the Remote Desktop Hosts, we'll begin.

Go to: Start --> Run

Type in "regedit".  Hit "OK".


Navigate down to:



Click on "PortNumber".  Then using the "Edit" menu, click "Modify", and select "Decimal".


Now type in the port number you want to use.  In this example, I'll pick "4000".  You have to be careful in picking port numbers so they don't interfere with other programs you maybe using.


Click "OK" and close the Registry Editor.  You will need to reboot the computer for the changes to take effect.

Next, we go into our router to forward the proper ports to the proper computer.  In our example, computer 1 is and uses port 4000, computer 2 is and used port 4001, and computer 3 is and is on port 4002.  So our port forwarding page might look something like this.


So how do we connect to these Remote Desktop Servers now that they have different port numbers?

Start the Remote Desktop Client.  Basically it's the same thing as using the Client normally, except that you add a port number to the computer name.  In our example, the computer name is located at and we're using port 4000, so our client looks like this:


Now if you wanted to connect to computer 2, just type in "temphost:4001", then for computer 3, you use "temphost:4002".  In this method, we address each computer by its unique port number.

Even if you are just using one computer behind a router with Remote Desktop, it is a good idea to change the port number just for security sake.

Back to Remote Desktop Overview

Additional Information