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

Reset RHEL7 ROOT password

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

Share

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

The first step is to start the system, then press any key to interrupt the normal boot process, and then you will see the screen shown below. Here, select the GRUB option (highlighted in blue in the snapshot below) and press "e" to edit

Step two, change the kernel

Go to the end of the line here, then write rd.break console=tty0 after the word UTF-8 (highlighted in blue in the snapshot below), and press Ctrl + x to continue. Please follow the snapshot below.

After pressing Ctrl + x, it will enter the console, as shown in the snapshot below.

The third step is to authorize / sysroot write permissions

Here, we need to mount / sysroot with rw (read / write) permission to reset root passwd, because / sysroot is in ro (read-only) permission mode by default

We can use the mount command to check, please follow the snapshot below.

So let's mount / sysroot with rw (read / write) permissions using the following command

As we can see in the snapshot below, / sysroot now has rw (read / write) permissions

Now, type the command chroot / sysroot / here to treat the directory as the root and redirect you to the shell prompt as shown below.

Sh-4.2#

Step 4, reset the root password

So now we have Shell Prompt. Here, we can use the passwd command to reset the linux root password, as shown in the following snapshot

As we can see on the snapshot, the root password has been updated, and now successfully run the following command to automatically relabel the file system for SElinux.

Then run the exit command to exit from Shell Prompt, and then run the reboot command to restart the system

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