How Do I Change the Login Mode of a Linux ECS from Key Pair to Password?
Scenarios
This section describes how to change the login mode of a Linux ECS from key pair to password.
Procedure
- Use the key to log in to the Linux ECS and set the password of user root.
sudo passwd root
If the key file is lost or damaged, reset the password of user root. For details, see How Can I Reset the Password for User root in the Single-User Mode on a Linux ECS?
- Modify the SSH configuration file on the ECS as user root.
su root
vi /etc/ssh/sshd_config
Modify the following settings:
- Change PasswordAuthentication no to PasswordAuthentication yes.
Alternatively, delete the comment tag (#) before PasswordAuthentication yes.
- Change PermitRootLogin no to PermitRootLogin yes.
Alternatively, delete the comment tag (#) before PermitRootLogin yes.
- Change PasswordAuthentication no to PasswordAuthentication yes.
- Restart sshd for the modification to take effect.
- Restart the ECS. Then, you can log in to the ECS as user root using the password.
To prevent unauthorized users from using the key file to access the Linux ECS, delete the /root/.ssh/authorized_keys file or clear the authorized_keys file.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot