How to quickly modify the root password under CentOS8

How to quickly modify the root password under CentOS8

Start the centos8 virtual machine and press the up and down keys to select the first line in the interface in Figure 1

As shown in Figure 1

As shown in Figure 1

Press the 'e' key to enter the interface shown in Figure 2, and move the down arrow key to the line that begins with "linux16". Then press the right arrow key to move, find "ro" and change it to " rw init=/sysroot/bin/bash ". (There is a space after rw, and \ is added by the system itself), as shown in Figure 3.

As shown in Figure 2

As shown in Figure 2

As shown in Figure 3

As shown in Figure 3

Press and hold the Ctrl and x keys at the same time, and the system will enter the following interface, which is the emergency mode. As shown in Figures 4 and 5.

This interface has a long waiting time

As shown in Figure 4, the waiting time for this interface is relatively long, so you need to wait patiently.

insert image description here
As shown in Figure 5

4. Run the command " chroot /sysroot/ " to switch back to the original system (i.e. centos7), and then you can change the password. After changing the password, run the command " touch /.autorelabel " to make SELinux take effect and the password take effect. As shown below. (If the following garbled characters appear (vmware does not support Chinese characters, so squares are displayed), temporarily set the current terminal language to English). As shown in Figure 6.

/# chroot /sysroot/
	/# LANG=en (Change the language to English)
	/#passwd
	/# touch /.autorelabel 

insert image description here

As shown in Figure 6
5. Press and hold the "Ctrl+d" keys at the same time, enter "reboot", and press the Enter key to restart the system. As shown in Figure 7.


As shown in the figure

As shown in Figure 7

6. Enter this interface and enter the newly set root password to log in successfully. As shown in Figure 8.

insert image description here

As shown in Figure 8

7. Login successful and enter the centos8 system. As shown in Figure 9.

insert image description here

As shown in Figure 9

At this point, the root password of the centos8 system has been modified!

Summarize

This is the end of this article about how to quickly change the root password under CentOS8. For more relevant centOS8 root password cracking content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • CentOS 7 set grub password and single user login example code
  • How to change the password of mysql5.7.20 under linux CentOS 7.4
  • How to reset the root password in CentOS7
  • How to modify the root password of MySQL in CentOS environment
  • Solution to the problem of still having to enter a password after configuring ssh password-free login in centos
  • How to install and modify the initial password of mysql5.7.18 under Centos7.3
  • How to change mysql password under Centos
  • CentOS 7 Forgot Password Solution Process Diagram

<<:  How to draw the timeline with vue+canvas

>>:  A brief analysis of the tutorial on installing MySQL 8.0.18 on CentOS 6.8 (RPM method)

Recommend

Solution to the problem that elements with negative z-index cannot be clicked

I was working on a pop-up ad recently. Since the d...

How to monitor Windows performance on Zabbix

Background Information I've been rereading so...

Detailed analysis of binlog_format mode and configuration in MySQL

There are three main ways of MySQL replication: S...

Create a custom system tray indicator for your tasks on Linux

System tray icons are still a magical feature tod...

Sample code for modifying the input prompt text style in html

On many websites, we have seen the input box disp...

Solution to Incorrect string value in MySQL

Many friends will report the following error when...

A brief discussion on three methods of asynchronous replication in MySQL 8.0

In this experiment, we configure MySQL standard a...

Detailed explanation of meta tags (the role of meta tags)

No matter how wonderful your personal website is,...

Life cycle and hook functions in Vue

Table of contents 1. What is the life cycle 2. Th...

Share the 15 best HTML/CSS design and development frameworks

Professional web design is complex and time-consu...

A few front-end practice summaries of Alipay's new homepage

Of course, it also includes some personal experien...

Deep understanding of the use of ::before/:before and ::after/:after

Part 1: Basics 1. Unlike pseudo-classes such as :...

How to achieve seamless token refresh

Table of contents 1. Demand Method 1 Method 2 Met...

Building the User Experience

<br />Maybe you've just come into a comp...

How to change the password of mysql5.7.20 under linux CentOS 7.4

After MySQL was upgraded to version 5.7, its secu...