Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What if CentOS7.2 forgets the root password?

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how CentOS7.2 forgets the root password for you. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

The way the CentOS 7 root password is reset is completely different from that of CentOS 6. Take changing the root password in single-user mode as an example.

1. Reboot, press esc, press e on the first line to edit

two。 Edit and modify two things: change ro to rw, and add init=/bin/sh after LANG=en_US.UFT-8

3. Press Ctrl+X to restart and change the password

4. Since selinux is open, you need to execute the following command to update the system information, otherwise the password will not take effect after reboot.

Our department shuts down selinux

# vi / etc/sysconfig/selinux

5. Restart the system

# exec / sbin/init

Add: let's take a look at how to reset the CentOS 7.2 ROOT password

Description:

This document has been successfully tested on CentOS 7.2kernel version 3.10.0 system.

-

First milestone-Select the edit option in the launch GRUB menu and press "e" to enter the edit

Second milestone-find "ro" around line 16 and change "ro" to "rw init=/sysroot/bin/bash"

Third milestone-press "ctrl + x" at the same time to enter single-user mode

The fourth milestone-- enter the system with the "chroot / sysroot" command

Fifth milestone-- "passwd root" reset root password

The sixth milestone-- updating SELinux information with "touch / .autorelabel"

Seventh milestone-enter "exit" to exit chroot

Eighth milestone-restart your system with "reboot-f"

Ninth milestone-- Landing system Test

This is the end of the article on "how CentOS7.2 forgets the root password". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report