What do I do if an error message, such as "This account is currently not available", appears when I connect to a Linux ECS instance by using SSH?
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 run an SSH command to log on to a Linux ECS instance, the connection fails and the error message "This account is currently not available." appears even if you enter the correct username and password.
Run the cat /var/log/secure command to view the logon log. Information similar to the following is displayed.
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 usually occurs because the default shell of the corresponding user (such as test) is modified in the user configuration file (/etc/passwd) of the ECS instance, which prevents the user from logging on.
Solution
You can modify the shell of the corresponding user (such as test) to resolve the logon failure.
-
Log on to the ECS instance by using VNC, as described in Connect using VNC.
-
Run the following command to view the default shell of the corresponding user (such as test).
cat /etc/passwd | grep usernameA result similar to the following is displayed, which indicates that the shell of the test user is changed to
/sbin/nologinand logon is not allowed.test:x:1000:1000::/home/test:/sbin/nologin -
Modify the shell of the user.
NoteWe recommend that you back up files before you modify the policy configuration.
-
Open the user configuration file (/etc/passwd).
vi /etc/passwd -
Change the default shell of the corresponding user (such as test) to bash. That is, change
/sbin/nologinto/bin/bash, as shown in the following example.test:x:1000:1000::/home/test:/bin/bash -
Press the Esc key, enter
:wq, and then save the modification.
-
-
Use the user to connect to the Linux instance again and make sure that the connection is normal.
NoteTips: If you have any questions, see Guidelines for troubleshooting failure to remotely log on to Linux instances through SSH.
Application scope
-
ECS