tencent cloud

Feedback

sshd Configuration File Permissions

Last updated: 2024-01-06 17:32:18

    Issue Description

    During login to a Linux instance via SSH key, "ssh_exchange_identification: Connection closed by remote host" or "no hostkey alg" is displayed.

    Common Causes

    sshd configuration file permissions, such as the permissions of the /var/empty/sshd or /etc/ssh/ssh_host_rsa_key configuration file, are modified, which may cause a failure in login via SSH key.

    Solution

    Perform the steps based on the actual error message to modify the configuration file permissions:
    If the error message is "ssh_exchange_identification: Connection closed by remote host", see Modifying permissions of /var/empty/sshd file.
    If the error message is "no hostkey alg", see Modifying permissions of /etc/ssh/ssh_host_rsa_key file.

    Troubleshooting Procedure

    Modifying permissions of /var/empty/sshd file

    2. Run the following command to view the error cause:
    sshd -t
    Information similar to the following is returned:
    "/var/empty/sshd must be owned by root and not group or world-writable."
    3. Run the following command to modify the permissions of the /var/empty/sshd/ file:
    chmod 711 /var/empty/sshd/

    Modifying permissions of /etc/ssh/ssh_host_rsa_key file

    2. Run the following command to view the error cause:
    sshd -t
    The returned information contains the following field:
    "/etc/ssh/ssh_host_rsa_key are too open"
    3. Run the following command to modify the permissions of the /etc/ssh/ssh_host_rsa_key file:
    chmod 600 /etc/ssh/ssh_host_rsa_key
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support