Home >Operation and Maintenance >CentOS >Root user cannot log in under centos
Problem:
The root password under centos is entered correctly, but you still cannot log in locally. When you enter an incorrect password, you will be prompted for an incorrect password.
Cause:
The root user is disabled.
Disable command:
usermod -s /sbin/nologin
(Recommended tutorial: centos tutorial)
Solution:
1. Enter single-user mode , edit the /etc/passwd file;
vim /etc/passwd
2. Find the root user information line, and the displayed information is as follows:
root:x:0:0:root:/root:/sbin/nologin
It means that the root user is indeed disabled.
3. Change the following "/sbin/nologin" to "/bin/bash". The modified information is:
root:x:0:0:root:/root:/bin/bash
4. Restart the machine.
Recommended related video tutorials: linux video tutorial
The above is the detailed content of Root user cannot log in under centos. For more information, please follow other related articles on the PHP Chinese website!