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 does CentOS7 reset the root password

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

Share

Shulou(Shulou.com)05/31 Report--

This article Xiaobian for you to introduce in detail "CentOS7 how to reset root password", the content is detailed, the steps are clear, the details are handled properly, I hope this "CentOS7 how to reset root password" article can help you solve your doubts, following the editor's ideas slowly in-depth, let's learn new knowledge.

Question:

Windows 10 Enterprise Edition 2016 lts

Vmware ®workstation 14 pro 14.1.0 build-7370693

Centos linux release 7.5.1804 (core)

The centos 7 root password installed in vmware has been forgotten and can only be reset

First, start the client

After entering the above interface, press e, and then enter the following interface

Second, modify the startup file

The cursor goes down to find the location of the linux16,ro

Change ro to rw init=/sysroot/bin/sh and press ctrl + x to restart.

Here to explain, some tutorials said to change to rw init=/bin/sh, anyway, I did not succeed! Restart the client after changing it to rw init=/bin/sh and report an error as follows

It is said that my bios crashes hw-pmu resources, and the client operating system has disabled cpu. Please shut down or reset the virtual machine. So I went to google according to this error for a long time, saying that the windows system did not turn on cpu virtualization, so I restarted the laptop and entered bios.

Found that intel virtualization technology is on, the problem is getting more and more outrageous, or change it to rw init=/sysroot/bin/sh!

III. Restart

After restarting the client, enter the following interface and execute chroot / sysroot

Execute passwd root to change root user password

: / # passwd rootchanging password for user rootnew password:retype new password:passwd: authentication token manipulation error

IV. Update / etc/shadow

If there is an error prompt authentication token manipulation error, it means that the root password change failed. Because there is no / etc/shadow file, as shown in the figure

Only gshadow and gshadow-. Regenerate the shadow file through pwconv and set the permission to-rw-r-

5. Remount the root partition

Mount-o remount,rw /

Change the root password at this time and find that it is OK.

: / # passwd rootchanging password for user rootnew password:retype new password:passwd: all authentication tokens updated successfully

Restart the client login successfully!

Read this, the "CentOS7 how to reset root password" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, 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

Development

Wechat

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

12
Report