Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking at needing to expose my Remote Desktop Server (Terminal Services) to be accessed from outside our network. Right now, it can only be accessed from inside our network.

I know it's easy enough to open up the firewall and forward the port.

However, how do I secure the machine itself and what are the best practices around this? My concern is hackers being able to work at breaking into it.

Any best practice guidelines/recommendations would be much appreciated.


Question about a product I found:

Filter Incoming RDP Connections by IP, MAC Address, Computer Name and More

Can anyone comment on the security of this? Looks like I could also use it to limit access by machine name/mac? Anyone else used it?

share|improve this question
I think you are asking not only how to secure this machine and any RDP connection to it, but also how to reduce the risk to the rest of your network should it be compromised. Is that right? – dunxd Apr 19 '12 at 16:49
Yes correct, due to how small we are, there is only one RDP server and it does need full desktop access/network resources for the internal users. – me2011 Apr 19 '12 at 17:06
up vote 13 down vote accepted

This may be more than what you're looking to do, but here's how we use RDP for remote users who aren't using VPN.

We recently started using the RD Gateway Manager with Remote Desktop Services, a role in Windows 2008. We have it setup to go through our TMG server and directly to a users machine. It uses NLA as mentioned above. The user connecting has to be a member of the right AD group, and a member of the right local group to be allowed access. Depending on how you want it setup, you can connect via a webpage which basiclly opens up mstsc and inputs the proxy setting for the RD Gateway, or you can set the settings on your machine manually so that each time you open it it attempts to go through that proxy. So far it has worked quite well and seems to be secure.

share|improve this answer
+1 for this. I also use RD Gateway with great success, and you need only expose port 443 to the internet for it to work. RD Gateway was not susceptible to that MS12-020 bug from a few weeks ago that threatened RDP. – Ryan Ries Apr 19 '12 at 18:06
+1 there are also a LOT fewer bots attacking RD gateways than there are direct RDP. – Grant May 30 '14 at 2:52

As recent history has shown us, there are inherent risks to exposing the protocol. But, there are some steps that you can take to protect the system:

  • Enforce Network Level Authentication.
  • Enforce connection encryption.
  • Restrict the users allowed to log in over Terminal Services to the absolute minimum, and don't allow "special" accounts like the default domain Administrator account, or ideally any other high privilege accounts.
  • Make sure the passwords are strong on accounts that are allowed to log in. Depends on how many users and how your policies look right now, but dumping the hashes and attempting to crack them, upping the limits on password length, or simply educating users are good approaches.
share|improve this answer

I strongly suggest using the Remote Desktop gateway service. It gives you a place where you can enforce policies about who can connect to what from where. It gives you a good place for logging, so you can see who is trying to login without inspecting the event logs of the individual servers in your farm.

If you haven't done it already, make sure your account lockout policies are set pretty strong. RDP even with NLA and a gateway give people something to attempt brute forcing passwords. A strong lockout policy greatly make it very difficult for brute force attempts to succeed.

Setup valid SSL certificates on the systems, so the client will notify end users if someone is trying to perform some kind of MITM attack.

share|improve this answer

This is not very secure, hoowever, there are a few ways to strengthen security.

Disallow Internet access from that server. Many of the more serious malware attempts to communicate back to their command and control server when it compromises your system. Configuring a firewall access rule to disallow outbound access by default, and a rule to allow outbound access only to internal/known networks and RFC 1928 subnets can mitigate the risk.

Use smart cards or some other type of two-factor authentication. This is typically expensive and found predominately in large organizations, however the options are improving (PhoneFactor comes to mind). Note that requiring smart cards can be done per-server, as an option to configuring it at the account level.

Configure a perimeter network, place the remote desktop server in the perimeter, and use an inexpensive VPN to provide the access. An example would be Hamachi. Note that disallowing Internet access from a perimeter network is also a good practice.

If possible, do not provide a full desktop, but publish the applications that they need. If someone only needs access to a single application, it is also possible to configure an "initial program", which could be a simple wrapper shell that can enforce a logoff when the application closes.

share|improve this answer

I would suggest the following measures :

  1. Change the port used for remote desktop connection
  2. Don't use generic usernames but a more complicated naming policy
  3. High passwords requirements
  4. Close any other unused port from outside (inbound)


  1. Use a VPN(CISCO , Open VPN etc) then connect to the server using internal IP.
  2. Use smart card log on if possible
share|improve this answer
I tend to change the port on the firewall, not on the server (doing it on the server requires changes to the registry). It's usually easier to setup a port forward on the router, and safer (no registry touching). – JohnThePro Apr 19 '12 at 16:12
Yap :) , I just said that because some people don't have access or knowledge to user port forwarding . Even though it is recommended not to change registry unless is necessary , I never had any issues . The only issue you can encounter is if you change it to an already used port . – Alex H Apr 19 '12 at 16:18
Yea, I mean its not the biggest deal in the world, and anyone who knows regedit is probably smart enough to be careful.... but you can't know that. :) – JohnThePro Apr 19 '12 at 16:19

You could run WinSSHD on port 22 and then use the Tunnelier client to create a tunnel for you and automatically open a Terminal services session through the tunnel with ONE click. This also gives you a very nice secure FTP option as well for transferring files.

share|improve this answer

I use ssh port forwarding for these things, and only allow user level, public key based authentication. All users private keys should be encrypted as well. On Windows Putty does this well, and pageant makes it easy for users to load their key. If you don't run any Linux/BSD servers that have ssh by default you can use OpenSSH in Cygwin to do this.

I recommend a dedicated remote shell server with a local firewall blocking things you don't want people remoting into, since allowing port forwarding in SSH is basically opening up any internal server/port to the users you want.

share|improve this answer

Bitvise SSH is a good free SSH for Windows.

I'd go for a cheap SSL VPN termination from client to Internet gateway perimeter for anything more than casual use (Commercial In-Confidence for example).

The above posts about securing RDP are also good practice and should always be done if you do not wish to share your computers with freeloaders.

share|improve this answer

not really best practice but some random thoughts:

  • keep your system updated - allow automated updates, dont use products that are end of life,
  • use long / complicated passwords for all system accounts
  • i'll get scolded here for suggesting the 'security through obscurity' but it will not do you any harm if you:
    • change the default 3389/tcp port to something else like 26438/tcp
    • add port-knocking [if possible] on the firewall level so that potential rdp user has first to visit some web page and only then can rdp to your server.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.