Server Security modification 3389 Remote Desktop port gadgets (package source code)

Source: Internet
Author: User
Tags server website
Introduction to port 3389:Port 3389 is the service port of Windows 2000 (2003) Server Remote Desktop. You can use the remote desktop and other connection tools to connect to the remote Server, after you enter the user name and password of the system administrator, the remote computer can be operated like a local computer. Therefore, the remote server generally changes or closes the port.

How do I modify a port?

Modify the port settings on the server. The Registry must be modified in two places. [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Terminal Server \ Wds \ rdpwd \ Tds \ tcp] PortNumber value. The default value is 3389, Which is changed to the expected port, as you said, it should be 6222. Second place: [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Terminal Server \ WinStations \ RDP-Tcp] PortNumber value. The default value is 3389. Change it to the expected port. The value is 6222, it will be OK after restarting. In this way, you must add the modified port number to the firewall exception if you want to continue using the Remote Desktop after modifying the port number of your computer and enable the firewall on the computer. Otherwise, the Remote Desktop cannot be connected to both 3389 and the modified port number.

Overseas Service users cannot afford:

After years of practice, it is concluded that, due to the interference of the Greater China firewall, Remote Desktop Connection to foreign servers will often lead to 3389 port communication blocking, while other accesses are normal, including server Website access (of course, port 80 is blocked intermittently ).

Because I have two servers, most of them are normal. If the other server is not working, I can remotely access one internal server and try again. Sometimes it's hard to get confused when neither of them is running.

Suddenly come to consciousness:

Recently, I suddenly realized that, since 3389 is the default congestion, the port has been changed. After the change, the remote connection went smoothly and the server security was also improved.

How to change it?

You can directly modify the registry and write code in case of any problems. You can download a small tool from the Internet and write code in case of security issues.

As a result, it is very simple. After a few minutes of refreshing, I wrote one myself, and the code was just a bit:

Public static void Change (int port) {try {RegistryKey runKey = Registry. localMachine. openSubKey (@ "SYSTEM \ CurrentControlSet \ Control \ Terminal Server \ Wds \ rdpwd \ Tds \ tcp", true); if (runKey! = Null) {runKey. setValue ("PortNumber", port); runKey. close ();} runKey = Registry. localMachine. openSubKey (@ "SYSTEM \ ControlSet001 \ Control \ Terminal Server \ WinStations \ RDP-Tcp", true); // win7 if (runKey! = Null) {runKey. setValue ("PortNumber", port); runKey. close ();} runKey = Registry. localMachine. openSubKey (@ "SYSTEM \ CurrentContro1Set \ Control \ Tenninal Server \ WinStations \ RDP \ Tcp", true); // win2003 if (runKey! = Null) {runKey. SetValue ("PortNumber", port); runKey. Close () ;}messagebox. Show ("modified successfully. It takes effect after the computer is restarted. ");} Catch (Exception err) {MessageBox. Show (err. Message );}}

For example, after the tossing Winform tool, there is an additional Code, mainly to avoid your own mistakes, the Code should be added to. com during the modification to enhance your memory:

 

If you are too lazy to download and package the source code:/Files/cyq1162/Change3389.rar

In addition, today's festival, the company's women have all run away and are not in the mood to work. Oh, you can challenge the top 10 programmers I designed.: Basic knowledge game for developers, 10 off in total. Welcome to the challenge.

 

Original Text connection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.