Help Center/ Elastic Cloud Server/ Troubleshooting/ Remote Login/ Remote Login Errors on Linux/ What Do I Do If "Too many authentication failures for root" Is Reported When I SSH Into a Linux ECS?
Updated on 2026-07-07 GMT+08:00

What Do I Do If "Too many authentication failures for root" Is Reported When I SSH Into a Linux ECS?

Symptom

When an SSH client is used to remotely connect to a Linux ECS, the connection fails and the message "Too many authentication failures" is displayed.

Possible Causes

The password retry policy is configured in the SSH remote login configuration file (/etc/ssh/sshd_config). This error message is displayed when an incorrect password is entered for a specified number of consecutive times.

Solution

  1. Remotely log in to the ECS.
  2. Run the following command to check whether the sshd_config file contains the following configuration:

    cat /etc/ssh/sshd_config

    If information similar to the following is displayed, the SSH connection will be disconnected after you enter incorrect passwords for six consecutive times:

    MaxAuthTries 6

    The MaxAuthTries parameter is disabled by default. This parameter specifies the maximum number of consecutive incorrect password attempts allowed for each SSH login. If the number of consecutive incorrect password attempts exceeds the specified value, the SSH connection will be disconnected and an error message will be displayed.

  3. Run the following command to open the SSH configuration file and modify the user login control parameter:

    vi /etc/ssh/sshd_config

  4. Press i to enter insert mode.
  5. Set MaxAuthTries to a large value or add a number sign (#) before the MaxAuthTries parameter.
    • Modify the password retry policy:
      MaxAuthTries 999
    • Cancel the policy configuration:
      # MaxAuthTries 6
  6. Press Esc to exit insert mode. Then, enter :wq to save the settings and exit.
  7. Restart the sshd service.
    • CentOS 6: service sshd restart
    • CentOS 7: systemctl restart sshd