Help Center/ Host Security Service/ FAQs/ Security Configurations/ Why Can't I Receive a Verification Code After 2FA Is Enabled?
Updated on 2024-05-16 GMT+08:00

Why Can't I Receive a Verification Code After 2FA Is Enabled?

  • The two-factor authentication function does not take effect immediately after being enabled.

    Wait for 5 minutes and try again.

  • To enable two-factor authentication, you need to disable the SELinux firewall.

    Disable the SELinux firewall and try again.

  • Linux servers require user passwords for login.

    To switch from the key login mode to password login mode, perform the following steps:

    1. 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.

    2. 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.

    3. Restart sshd for the modification to take effect.

      service sshd restart

    4. 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.