Home > Operation and Maintenance > CentOS > How to solve the problem that root user cannot log in under centos

How to solve the problem that root user cannot log in under centos

WJ
Release: 2020-06-02 16:21:48
Original
8752 people have browsed it

How to solve the problem that root user cannot log in under centos

How to solve the problem that 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
Copy after login

Solution:

1. Enter single-user mode and edit the /etc/passwd file;

vim /etc/passwd
Copy after login

2. Find the root user information line. The displayed information is as follows:

root:x:0:0:root:/root:/sbin/nologin
Copy after login

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
Copy after login

4. Just restart the machine.

Related recommendations: centOS tutorial

The above is the detailed content of How to solve the problem that root user cannot log in under centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template