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
On this page

Show all

Help Center/ Bare Metal Server/ FAQs/ OS FAQ/ How Do I Set SSH Configuration Items?

How Do I Set SSH Configuration Items?

Updated on 2024-05-09 GMT+08:00

You can select the BMS login mode or account type. If you require special configuration, perform the following operations:

  1. To improve security of the BMS, disable remote login using the password and retain only the certificate login mode. Configure the following parameters:
    • Check whether the /etc/cloud/cloud.cfg file contains parameter ssh_pwauth and its value is false. If not, add the parameter or change its value to false. This ensures that password cannot be used to log in to the BMS using Xshell.
    • Check whether the value of parameter ChallengeResponseAuthentication in the /etc/ssh/sshd_config file is no. If not, change it to no. This ensures that password cannot be entered using the keyboard inactive method to log in to the BMS using Xshell.
  2. To enable remote login as user root and enable SSH permissions of user root, perform the following operations:
    CAUTION:

    This operation may cause risks. Exercise caution before performing this operation.

    1. Modify the Cloud-Init configuration file.

      Take CentOS 6.7 as an example. Modify the following parameters:

      users: 
        - name: root 
          lock_passwd: false 
        
      disable_root: 0 
      ssh_pwauth: 1

      In the preceding information:

      • If the value of lock_passwd is set to false, user password is not locked.
      • disable_root specifies whether to disable remote SSH login as user root. Set the value to 0, indicating that the remote SSH login as user root is enabled (In some OSs, value true indicates disabled and false indicates enabled).
      • ssh_pwauth specifies whether to support SSH password login. Set this parameter to 1, indicating that SSH password login is supported.
    2. Run the following command to open the /etc/ssh/sshd_config file using the vi editor:

      vi /etc/ssh/sshd_config

      Change the value of PasswordAuthentication in the sshd_config file to yes.

      NOTE:
      • For SUSE and openSUSE, set PasswordAuthentication and ChallengeResponseAuthentication in the sshd_config file to yes.
      • For Ubuntu, set PermitRootLogin to yes.
    3. Lock the initial password of user root in the image template by modifying the shadow file to prevent risks.
      1. Run the following command to open the /etc/shadow configuration file using the vim editor:

        vim /etc/shadow

        Add !! to the password hash value of the root account. The modified configuration file is as follows:

        # cat /etc/shadow | grep root 
         root:!!$6$SphQRPXu$Nvg6izXbhDPrcY3j1vRiHaQFVRpNiV3HD/bjDgnZrACOWPXwJahx78iaut1IigIUrwavVGSYQ1JOIw.rDlVh7.:17376:0:99999:7::
      2. After the configuration file is modified, press Esc and enter :wq to save and exit the file.
        NOTE:

        For Ubuntu, delete the user created during the OS installation. For example, run the userdel -rf ubuntu command to delete user ubuntu created during OS installation.

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