All Products
Search
Document Center

:An error is reported when you log on to an ECS instance of the Linux system by using SSH commands

Last Updated:Apr 13, 2022

Disclaimer: This article may contain information about third-party products. Such information is for reference only. Alibaba Cloud does not make any guarantee, express or implied, with respect to the performance and reliability of third-party products, as well as potential impacts of operations on the products.

Problem description

When you use an SSH command to log on to an ECS instance of the Linux system, the connection fails even if you use a normal account and password. Errors similar to the following are also displayed in the command-line or secure logs.

  • This account is currently not available.
  • Connection to 127.0.0.1 closed.
  • Received disconnect from 127.0.0.1: 11: disconnected by user.
  • Pam_unix (sshd: session): session closed for user test.

Causes

This problem is usually caused by the modification of the default Shell of the corresponding user.

Solution

  1. Log on to an instance. For more information about how to log on to an instance, see Connect to a Linux instance by using a management Terminal.
  2. Run the following command to view the default Shell of the corresponding user.
    Cat/etc/passwd | grep test
    The command output is as follows. The Shell of the logon user is changed to nologin.
    test:x:1000:1000::/home/test:/sbin/nologin
  3. We recommend that you back up files before you modify the policy configuration.
  4. Run the following command to edit /etc/passwd file, and change the default Shell of the corresponding user to bash, that is /sbin/nologin change /bin/bash save the settings and exit.
    vi /etc/passwd
  5. Try to connect to the server again on the client and make sure that the connection is normal.
    Tips: If you have any questions, see Guidelines for troubleshooting failure to remotely log on to Linux instances through SSH.

Application scope

  • ECS