All Products
Search
Document Center

:Resolve the "Failed to start OpenSSH server daemon" error message on a Linux ECS instance

Last Updated:Dec 24, 2025

This topic explains how to resolve the "Failed to start OpenSSH server daemon" error, which can occur when you start the SSH service on a Linux Elastic Compute Service (ECS) instance.

Problem description

The SSH service (sshd.service) fails to start on a Linux ECS instance. Running the systemctl status sshd.service command to check the SSH service status returns the Failed to start OpenSSH server daemon error.

sshd状态

Cause

This issue occurs when the default SSH service port (22) is used by another application.

Solution

To resolve this issue, you can either change the conflicting service's port or the SSH service's port.

  1. Connect to the Linux ECS instance using Virtual Network Computing (VNC).

    For more information, see Choose an ECS remote connection method.

  2. Start the SSH service in debug mode.

    /sbin/sshd -d

    The output indicates that the SSH service cannot start because port 22 is in use.

    端口被占用

  3. Check which process is using port 22.

    ss -tunlp | grep 22

    The following output shows that the NGINX service is using port 22.

    Important

    In this example, the NGINX service uses port 22. Your actual port conflict may involve a different service.

    Ngnix占用22

  4. Choose one of the following solutions.

    • Change the NGINX service port.

      1. Open the nginx.conf configuration file.

        vim /etc/nginx/nginx.conf
      2. Change the NGINX port to 80.

        修改Ngnix占用端口

      3. Press Esc, enter :wq, and then press Enter to save the file and exit.

      4. Restart the NGINX service.

        systemctl restart nginx 
      5. Restart the SSH service.

        systemctl restart sshd.service 
    • Change the SSH service port.

      1. Open the ssh_config configuration file.

        vim /etc/ssh/sshd_config
      2. Change the SSH service port, for example, to 2222.

        修改SSH占用端口

      3. Press Esc, enter :wq, and then press Enter to save the file and exit.

      4. Restart the SSH service.

        systemctl restart sshd.service