In CentOS, if everything goes well, if you create a new user, it will be automatically added to the SSHD login service. There is no need to manually or set anything, but there are some In this case, our system only allows the root user to log in, then we need to make some necessary settings. The specific steps are as follows:
1. When you log in, please make sure that the user name you entered and For the correctness of the password, it is best to see the user name in /home/ and its related folders. If you are creating a new user without a home, you must also check whether the relevant user name and other information already exist in the /etc/passwd file. content.
(Recommended tutorial: centos usage tutorial)
2. Check the #vim /etc/ssh/sshd_config file and you will find that the UsePam certification has been opened.
Solution:
3. Modify "-:ALL EXCEPT root :ALL" in #vim /etc/security/access.conf to "-:ALL EXCEPT root yourusername :ALL" .
4. Restart the sshd service.
Note: If you modify this configuration through remote login, the "root" user in the above cannot be removed. Otherwise, if any abnormality occurs, you will have to find another way to log in again. If After this configuration modification is successful, you can remove the login authentication of the root user.
Recommended related video tutorials: linux video tutorial
The above is the detailed content of Ordinary users of centos system cannot log in to ssh. For more information, please follow other related articles on the PHP Chinese website!