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

Linux's root password forgot how to change it.

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "Linux root password forgot how to modify", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly in-depth, together to study and learn "Linux root password forgot how to modify"!

usage scenarios

Linux administrators forget their root password and need to retrieve it.

Note: this article is based on centos 7 environment, because centos versions are different, please confirm the good version before continuing.

step

1. Restart the system. During the boot process, quickly press the arrow keys ↑ and ↓ on the keyboard. The goal is to inform the bootstrap that we need to select different actions on the boot page in order to pause the bootstrap.

The following is the interface after the pause, you can see the English below to see the role of ↑ and ↓.

II. Use ↑ and ↑ to set the selected line as the first line (background highlight is selected), press e on the keyboard to enter edit mode.

Move the cursor all the way to LANG=en_US. UTF-8, space, and then add init=/bin/sh. Special attention here needs to be paid to writing after UTF-8, keeping it on the same line, and paying attention to spaces. Some virtual machines automatically add\newlines because the screen is too small, this is normal.

IV. Press CTRL+X to boot, and enter the interface after success.

5. Enter the following command

1. Mount the root directory

mount -o remount, rw /

2. Select the user name to modify the password. Select root user to modify it. You can change it to the user you want to modify.

passwd root

3. Enter the same new password twice. Note that no characters will appear on the screen when entering the password.

BAD PASSWORD: The password fails the dictionary check - it is too simple/systematic. You can ignore it and continue to enter the password. However, it is recommended to set a more complex password to ensure security.

4. If SElinux is already turned on, you need to enter the following command

touch /.autorelabel

5. Finally, enter the following command to restart the system

exec /sbin/init

or

exec /sbin/reboot

Thank you for reading, the above is the "Linux root password forgot how to modify" content, after the study of this article, I believe that everyone forgot how to modify the Linux root password has a deeper understanding of the problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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

Internet Technology

Wechat

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

12
Report