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

CentOS 7 forgot the root password modification method

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

Share

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

The root password recovery of CentOS 7 is different from that of 5Power6, because 7 uses GRUB2 to start, and it is impossible to reset the root password through single-user mode if you forget your password. Here are two tips to help you easily reset your root password.

The first move to amend the Dafa

Press "esc" to turn on the computer

Select "CentOS Linux (3.10.0-327.)" and press the "e" key to enter

Move the cursor to the line at the beginning of "linux16" and find "ro" instead of "rw init=sysroot/bin/sh"

Press "Ctrl+x" to execute

Enter "chroot / sysroot" after entering

Enter "passwd"

Enter the new password twice according to the prompt

Enter "touch / .autorelabel" to update system information

Enter exit or press Ctrl+d to exit

Enter "reboot" to restart

The second move to amend the Dafa

Press "esc" to turn on the computer

Select "CentOS Linux (3.10.0-327.)" and press the "e" key to enter

Move the cursor to the line at the beginning of "linux16" and add "init=/bin/bash" at the end of the line

Press "Ctrl+x" to execute

Mount the file system to be writable

Enter "passwd"

Enter the new password twice according to the prompt

Enter "touch / .autorelabel" to update system information

Enter "exec / sbin/init" to start the system normally

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