tencent cloud

Feedback

sshd Configuration File Permissions

Last updated: 2022-03-30 15:14:43

    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:

    Troubleshooting Procedure

    Modifying permissions of /var/empty/sshd file

    1. Log in to the Linux instance via VNC.
    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."
    
    1. 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

    1. Log in to the Linux instance via VNC.
    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"
    
    1. 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