This topic describes the cause of and solution to the following issue: The Logon failed because password-based logon is disabled in the operating system error message appears when you connect to a Linux Elastic Compute Service (ECS) instance by using Workbench.
Problem description
When you connect to a Linux ECS instance by using a password on Workbench, the following error message appears: Logon failed because password-based logon is disabled in the operating system.
Cause and solution
The preceding issue may occur due to the following reasons:
No logon password was configured when the ECS instance was created. In this case, you can configure a logon password for the ECS instance. For more information, see Reset the logon password of an instance.
The account that you use has overdue payments. If you connect to the ECS instance by using the public IP address of the instance, the connection fails due to overdue payments in your account. In this case, you can use the private IP address of the instance to connect to the ECS instance or complete the overdue payments and then connect to the ECS instance.
An SSH key pair is bound to the ECS instance. If an SSH key pair is bound to the ECS instance, password-based authentication is automatically disabled for the instance. To enable password-based authentication for the ECS instance, you can reset the logon password of the instance or modify the SSH configuration file. For more information, see Reset the logon password of an instance or the Modify the SSH configuration file section of this topic.
Modify the SSH configuration file
Connect to the ECS instance by using key pair-based authentication or by using Virtual Network Computing (VNC) based on your business requirements and modify the SSH configuration file.
Connect to the ECS instance by using key pair-based authentication or by using VNC.
For more information, see Connect to a Linux instance by using a password or key or Connect to an instance by using VNC.
Check the value of the
PasswordAuthentication
parameter in the/etc/ssh/sshd_config
file.cat /etc/ssh/sshd_config
The following figure shows that the
PasswordAuthentication
parameter is set tono
, which indicates that password-based authentication is disabled. To enable password-based authentication, set the PasswordAuthentication parameter toyes
.Change the value of the
PasswordAuthentication
parameter toyes
.Open the SSH configuration file.
sudo vim /etc/ssh/sshd_config
Change
PasswordAuthentication no
toPasswordAuthentication yes
.Press the
Esc
key, enter:wq
, and then press theEnter
key to save the change.
Restart the sshd service for the change to take effect.
sudo systemctl restart sshd.service
Connect to the ECS instance by using a password. If you can connect to the ECS instance, the issue is resolved.
For more information, see Connect to a Linux instance by using a password or key.