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
Situation Awareness
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
Help Center/ Elastic Cloud Server/ User Guide/ Passwords and Key Pairs/ One-Click ECS Password Reset Plug-in/ Using Scripts to Batch Update the One-Click Password Reset Plug-ins for Linux ECSs

Using Scripts to Batch Update the One-Click Password Reset Plug-ins for Linux ECSs

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

Scenarios

You can use scripts to batch update the one-click password reset plug-ins for multiple Linux serverss.

Prerequisites

  • An executor ECS meeting the requirements in Constraints is available.
  • You have obtained the IP addresses of the ECSs where the plug-ins are to be batch installed, and the password of user root or the private key file for login.
  • The executor ECS and the ECSs whose password reset plug-ins are to be updated must be in the same VPC.
  • The EIP can be unbound only after you perform step 6.

Constraints

  • The executor ECS must use the public image CentOS 7, has an EIP bound, and can communicate with the ECSs where the plug-ins are to be batch installed.
    NOTE:

    If the internal yum repository has been configured, the executor ECS does not require an EIP.

  • Only ECSs that use the same key pair support the batch installation of plug-ins.

Procedure

  1. Log in to the executor ECS as user root.
  2. Install the dependency required for batch script execution.

    yum install ansible -y

  3. Download the plug-in package CloudResetPwdAgent.zip and verify its integrity by referring to Obtaining the One-Click Password Reset Plug-in and Verifying Its Integrity (Linux).

    There is no special requirement for the directory that stores CloudResetPwdAgent.zip.

  4. Download the batch execution script to the root directory.

    curl URL > ~/batch_update_log4j_version.py

    URL is the address for downloading the batch execution script.

    Select an address for downloading the script based on the region where the ECSs are located.

  5. Download the plug-in update script to the root directory.

    curl URL > ~/update_log4j_version_for_resetpwdagent.sh

    URL is the address for downloading the plug-in update script.

    Select an address for downloading the script based on the region where the ECSs are located.

  6. Check whether the following scripts are in the root directory:
    • batch_update_log4j_version.py
    • update_log4j_version_for_resetpwdagent.sh
    • CloudResetPwdAgent.zip
  7. Create host_list.txt and press i to enter editing mode.

    vi host_list.txt

    Enter the information of the target ECSs in the host_list.txt file.

    The file format must match the login mode to be switched.

    • If the target ECSs use a key pair for authentication, enter the following information:
      CAUTION:
      • Upload the private key file saved during ECS creation to the folder in which host_list.txt is stored.
      • Ensure that the permission code of the private key file is 400.

        chmod 400 Private key file

      Enter an ECS IP address in each line.

      An example is provided as follows:

      192.168.1.10
      192.168.1.11
    • If the target ECSs use a password for authentication, enter the following information:

      Enter an ECS IP address and password of user root separated using a comma (,) in each line.

      An example is provided as follows:

      192.168.1.10,'**********'
      192.168.1.11,'**********'
  8. Run batch_update_log4j_version.py.
    • For ECSs authenticated using key pairs

      If the private key file and the batch execution script are in the same directory, you can simply use the private key file name.

      python batch_update_log4j_version.py {Private key file path/Private key file name}
      Figure 1 Successful script execution

      If information shown in Figure 1 is displayed, the execution is successful.

    • For ECSs authenticated using passwords

      python batch_update_log4j_version.py

      Figure 2 Successful script execution

      If information shown in Figure 2 is displayed, the execution is successful.

  9. View the execution result log in the last line of /root/logs/exec_origin.log.

    vim /root/logs/exec_origin.log

    If information shown in Figure 3 is displayed, the one-click password reset plug-ins are batch updated.

    Figure 3 Execution result log

Follow-up Procedure

  • After the one-click password reset plug-in is updated, you can add it to the startup items if it cannot automatically start upon ECS startup. For details, see What Do I Do If the One-Click Password Resetting Plug-In Failed to Start?
  • After the one-click password reset plug-in is updated, do not delete the CloudResetPwdAgent process. Otherwise, one-click password reset will not be available.
  • If you have updated the one-click password reset plug-in, newly created ECSs work in PIPE mode by default to prevent the plug-in from using service ports. Existing ECSs still work in AUTO mode, in which the plug-in selects an idle port with the smallest port number from 31000 to 32999.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback