In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you the relevant knowledge points about how RHEL7/CentOS7 resets the system password. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
Introduction
Purpose
Reset the root password in RHEL7/CentOS7/Scientific Linux 7.
Request
RHEL7 / CentOS7 / Scientific Linux 7
Degree of difficulty
Medium
Guidance
The world of RHEL7 has changed, and so has the way you reset your root password. Although the old method of interrupting the boot process (init=/bin/bash) is still valid, it is no longer recommended. "Systemd" uses "rd.break" to interrupt boot. Let's take a quick look at the whole process.
Start to enter the minimum mode
Restart the system and press e on the kernel list page before the system starts. You will enter edit mode.
Interrupt the startup process
In the kernel string-enter rd.break in the line ending with linux 16 / vmlinuz- ect. Then Ctrl+X restarts. The system boots into the initialization memory disk and mounts it in / sysroot. You do not need to enter a password in this mode.
Remount the file system to read and write switch_root:/# mount-o remount,rw / sysroot/ to make / sysroot the root directory switch_root:/# chroot / sysroot
The command line prompt changes slightly.
Modify root password
Sh-4.2# passwd
Load SELinux Policy
Sh-4.2# load_policy-I sets the context type sh-4.2# chcon-t shadow_t / etc/shadow in / etc/shadow
Note: you can skip the last two steps by creating an autorelabel file as follows, but it takes a long time to rebuild the volume label automatically.
Sh-4.2# touch /. Autorelabel
For this reason, although it is simpler, it should be a "lazy choice" rather than a suggestion.
Exit and restart
Log out and restart and log in with the new root password.
These are all the contents of the article "how to reset the system password for RHEL7/CentOS7". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.