All Products
Search
Document Center

Simple Application Server:An exception occurs during SSH remote connection on a Linux simple application server due to SELinux being enabled

Last Updated:Aug 12, 2024

Problem description

When you connect to a Linux ECS instance by using SSH, the following error message appears in the command output or secure log even after you enter the correct password:

Permission denied, please try again.
error: Could not get shadow information for root.

Cause

The SELinux service is enabled.

Solution

Temporarily or permanently disable the SELinux service to resolve the SSH connection exception. For more information, see Enable or disable SELinux.

  1. Check the status of SELinux.

    1. Use the rescue feature to connect to the simple application server. For more information, see Connect to a Linux server by using the rescue feature.

    2. Run the following command to view the status of SELinux:

      /usr/sbin/sestatus -v 

      Sample output:

      SELinux status:       enabled
      Note

      Valid values:

      • enabled: SELinux is enabled.

      • disabled: SELinux is disabled.

  2. Disable SELinux.

    Temporarily disable SELinux

    Run the following command to temporarily disable SELinux:

    setenforce 0

    Permanently disable SELinux

    1. Run the following command to permanently disable SELinux:

      sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
      Note

      You can use the preceding command only if SELinux is in the enforcing state.

    2. Restart the server to allow the setting to take effect. For more information, see View server information.