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

How to change root password by centos

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

Share

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

Today, what the editor shares with you is how centos changes the root password. I believe many people do not know much about it. In order to let you know more about the way centos modifies the root password, I have summarized the following contents for you. Let's look down together. I'm sure you'll get something.

The method of modifying root password by centos

Know the root password, you need to change the password

Log in to the system as root and enter the passwd command to change the root password by default, and then enter the password twice.

Application scenario

The linux administrator forgot the root password and needs to retrieve it.

Note: this article is based on the centos7 environment, because the version of centos is different, please determine the version before continuing.

Operation steps

First, restart the system, in the boot process, quickly press the keyboard direction keys ↑ and ↓. The goal is to tell the bootstrapper that we need to select a different action on the boot page in order for the bootstrapper to pause.

The following is the paused interface. You can check the English below to see the role of ↑ and ↓.

Use ↑ and ↓ to set the selected row to the first row (background highlight is selected), press e on the keyboard to enter edit mode

Third, move the cursor all the way after .UTF-8, a space, and then append init=/bin/sh. Note here that you need to write after UTF-8, keep it on the same line, and pay attention to the spaces. Because the screen is too small, it will automatically add\ newline, which is normal.

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

Enter the following command

1. Mount the root directory

Mount-o remount, rw /

2. Select the user name for which you want to change the password. Here, select the root user to change it, and you can change it to the user you want to modify.

Passwd root

3. Enter the same new password twice, and note that there are no characters on the screen when entering the password.

If the password you enter is too simple, you will be prompted with a warning (BAD PASSWORD:The password fails the dictionary check-it is too simplistic/systematic). You can ignore it and continue to enter the password, but it is recommended to set a more complex password to ensure security.

4. If you have enabled SElinux, 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

The above is a brief introduction of centos how to change the root password, of course, the detailed use of the above differences have to be used by everyone to understand. If you want to know more, welcome to follow the industry information channel!

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