众所周生,计算机远程桌面默认端口是3389,如果是在内网,不用担心被攻击,不用修改也是可以的。
但是如果是公布外网,存在被攻击的风险,所以需要更改默认端口以降低风险。
![图片[1]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221105106879-image.png)
那怎么修改默认端口呢?以下方法适用于的操作系统为:
适用范围:Windows Server 2022、Windows 10、Windows 8.1、Windows 8、Windows Server 2019、Windows Server 2016、Windows Server 2012 R2、Windows Server 2008 R2
1、启动注册表编辑器(三种方法)
开始–windows管理工具-注册表编辑器
或者WIN键+R 打开运行,输入regedit 也可以打开,或者在“搜索”框中键入 regedit
![图片[2]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221104643657-image.png)
2、导航到以下注册表子项:HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
找到PorNumber 打开
![图片[3]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221111151638-1703128249128.png)
![图片[4]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221111443391-1703128415715.png)
关闭注册表编辑器,然后重新启动计算机!!下次进入就要用新的端口进入了。
3、更改系统自带的防火墙规则
开始–windows管理工具–高级安全windows defender防火墙
![图片[5]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221111832657-1703128636369.png)
![图片[6]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221113919980-1703129871255.png)
新建入站规则
![图片[7]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221134817104-1703137638711.png)
![图片[8]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221134916217-1703137697780.png)
然后下一步,直到结束 就可以通过配好的端口访问了。
记得删除原来系统默认的规则
![图片[9]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221135116599-1703137794779.png)
也可能通过命令来改防火墙的端口,管理员运行PowerShell
可运行以下 PowerShell 命令来查看当前端口:
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"
![图片[10]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221135724231-image.png)
还可运行以下 PowerShell 命令来更改 RDP 端口。 在此命令中,我们会将新的 RDP 端口指定为 3390。
若要向注册表添加新的 RDP 端口:
$portvalue = 3390
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue
![图片[11]-修改计算机上的远程桌面的侦听3389端口-oserp](https://www.oserp.net/wp-content/uploads/2023/12/20231221140119173-image.png)
暂无评论内容