Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page
Help Center/ Elastic Cloud Server/ FAQs/ Remote Login/ Remote Logins/ How Can I Change a Remote Login Port?

How Can I Change a Remote Login Port?

Updated on 2025-01-10 GMT+08:00

Scenarios

This section describes how to change a port for remote logins.

Windows

The following procedure uses an ECS running Windows Server 2012 as an example. The default login port of a Windows ECS is 3389. To change it to port 2020, for example, do as follows:

  1. Modify the security group rule.
    1. Log in to the management console.
    2. Click in the upper left corner and select your region and project.
    3. Click . Under Compute, click Elastic Cloud Server.
    4. On the ECS list, click the name of an ECS for which you want to modify the security group rule.
    5. On the ECS details page, click the security group in the Security Groups area to go to the security group details page.
    6. On the Inbound Rules tab, click Add Rule. In the displayed dialog box, set Protocol & Port as follows:
      • Protocols: TCP (Custom ports)
      • Port: 2020

      For details, see Adding a Security Group Rule.

  2. Log in to the ECS.
  3. In the Run dialog box, enter regedit to access the registry editor.
  4. In Registry Editor, choose HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Control > Terminal Server > Wds > rdpwd > Tds > tcp and double-click PortNumber.
    1. In the dialog box that is displayed, set Base to Decimal.
    2. Change the value in Value data to the new port number, which is 2020 in this example.
      Figure 1 Changing the port number to 2020
  5. In Registry Editor, choose HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Control > Terminal Server > WinStations > RDP-Tcp and double-click PortNumber.
    1. In the dialog box that is displayed, set Base to Decimal.
    2. Change the value in Value data to the new port number, which is 2020 in this example.
      Figure 2 Changing the port number to 2020
  6. (Skip this step if the firewall is disabled.) Modify the inbound rules of the firewall.

    Choose Control Panel > Windows Firewall > Advanced Settings > Inbound Rules > New Rule.

    • Rule Type: Port
    • Protocol in Protocol and Ports: TCP
    • Port in Protocol and Ports: Specific local ports, 2020 in this example
    • Action: Allow the connection
    • Profile: Default settings
    • Name: RDP-2020

    After the configuration, refresh the page to view the new rule.

  7. Open the Windows search box, enter services, and select Services.
    Figure 3 Selecting Services
  8. In the Services window, restart Remote Desktop Services or the ECS.
  9. Use "IP address:Port" to remotely access the ECS.
    Figure 4 Remote Desktop Connection

Linux

The following procedure uses an ECS running CentOS 7.3 as an example. The default login port of a Linux ECS is 22. To change it to port 2020, for example, do as follows:

  1. Modify the security group rule.
    1. Log in to the management console.
    2. Click in the upper left corner and select your region and project.
    3. Click . Under Compute, click Elastic Cloud Server.
    4. On the ECS list, click the name of an ECS for which you want to modify the security group rule.
    5. On the ECS details page, click the security group in the Security Groups area to go to the security group details page.
    6. On the Inbound Rules tab, click Add Rule. In the displayed dialog box, set Protocol & Port as follows:
      • Protocols: TCP (Custom ports)
      • Port: 2020

      For details, see Adding a Security Group Rule.

  2. Log in to the ECS.
  3. Run the following command to edit the sshd configuration file:

    vi /etc/ssh/sshd_config

  4. Delete the comment tag (#) from the #port 22 line and change 22 to 2020.
    Figure 5 Changing the port number to 2020
  5. Press Esc to exit Insert mode and enter :wq! to save the settings and exit.
  6. Run either of the following commands to restart sshd:

    service sshd restart

    Or

    systemctl restart sshd

  7. Skip this step if the firewall is disabled. Configure the firewall.

    The firewall varies depending on the CentOS version. CentOS 7 uses firewalld, and CentOS 6 uses iptables. The following operations use CentOS 7 as an example.

    Run the firewall-cmd --state command to check the firewall status.

    • (Recommended) Method 1: Add information about a new port to firewalld.
      1. Run the following commands to add a rule for port 2020:

        firewall-cmd --zone=public --add-port=2020/tcp --permanent

        firewall-cmd --reload

      2. View the added port. The TCP connection of port 2020 will have been added.

        firewall-cmd --list-all

      3. Restart firewalld.

        systemctl restart firewalld.service

    • Method 2: Disable the firewall and the function of automatically enabling the firewall upon ECS startup.

      systemctl stop firewalld

      systemctl disable firewalld

  8. Run the following command to check whether the port is open:

    telnet EIP port

    For example: telnet xx.xx.xx.xx 2020

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback