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

Vue realizes simple effect of running light

This article shares the specific code of Vue to a...

Detailed explanation of JS variable storage deep copy and shallow copy

Table of contents Variable type and storage space...

Detailed explanation of docker nginx container startup and mounting to local

First, the structure inside the nginx container: ...

Detailed explanation of MySQL's MERGE storage engine

The MERGE storage engine treats a group of MyISAM...

How to download excel stream files and set download file name in vue

Table of contents Overview 1. Download via URL 2....

Insufficient memory problem and solution when docker starts elasticsearch

question Insufficient memory when docker installs...

Explanation of the usage of replace and replace into in MySQL

MySQL replace and replace into are both frequentl...

Instructions for using JSON operation functions in Mysql5.7

Preface JSON is a lightweight data exchange forma...

Rules for registration form design

I finished reading "Patterns for Sign Up &...

JS removeAttribute() method to delete an attribute of an element

In JavaScript, use the removeAttribute() method o...

Basic usage of @Font-face and how to make it compatible with all browsers

@Font-face basic introduction: @font-face is a CSS...

Solve the error during connect exception in Docker

When you first start using Docker, you will inevi...

Code to enable IE8 in IE7 compatibility mode

The most popular tag is IE8 Browser vendors are sc...