In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "Linux single-user mode how to reset root password", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "Linux single-user mode how to reset root password" bar!
Linux single-user mode reset root password 1, system run level 1. Linux system startup process
To get into single-user mode, we first need to understand the startup process of the system and confirm which step we are taking. Only by understanding can you really master it, and say goodbye to rote memorization.
Power on: for virtual machines, click the run button.
BIOS self-test: this step is mainly to perform various scans, confirm the boot mode and boot, such as hard disk, CD-ROM, network, etc.
Grub boot menu: if you already have a working operating system on your hard drive, you will enter the boot menu. This step is critical for us, because the next step is to load the kernel to start the init process, and then run the system according to the specified run level. If we want to temporarily change the boot level of the system and enter single-user mode, we have to do it in the boot menu.
Load the kernel: the system reads the relevant files in the / boot directory and loads the core content of the system
Init process: initialization process used to initialize the system environment
Determine the running level: make the system run at the specified level according to the configuration
User login: enter a user name and password to log in
Execute the login script: execute the script after the user logs in based on the user's configuration information (will be further described in the user management article)
two。 Related profile
/ boot/grub/grub.conf:grub boot menu configuration file
You can modify the countdown read seconds of the boot menu in this configuration file, corresponding to the configuration item: timeout.
You can also configure startup menu encryption in this file, corresponding to the configuration item: password. (will be introduced in the single-user encryption article)
/ etc/inittab: configure behaviors and commands under each run level, and can also be used to modify the default run level of the system
The content format of the configuration file is as follows:
Id:runlevels:action:process
Id is a custom name that is required to be unique within the file and is no more than four characters long.
The scope of runlevels is consistent with the running level of the system, and multiple can be specified at the same time.
Action represents the behavior to be performed at the specified level, which is a fixed value. Specifies that the configuration of the default run level after system startup is: initdefault.
The process section is used to specify the specific command to be executed, which can be omitted when action is specified as initdefault.
3. Run level list
Use the content in / etc/inittab directly for comparison.
0: shutdown
1: single user
2: multi-user (no NFS)
3: full multi-user mode
4: not in use yet
5: graphical interface
6: restart
4. Default run level
If you need to change the default run level, just change the original line in the configuration file to the number corresponding to the target level. For example, if you change the default run level from graphical interface to full multi-user mode, change 5 to 3.
# original content id:5:initdefault:id:3:initdefault: 2. Reset password in single-user mode
Press any key to enter the grub menu when you start up and read seconds.
Press e to enter the editing interface when prompted
Select the second item: kernel, continue to press e to edit
At the end, enter: [space] 1 [enter]
Go back to the menu interface and press b to start
After startup, you will enter single-user mode, and you can use the passwd command to reset the root user password directly.
In the password input state, the cursor will not produce any change, which is a normal phenomenon. Enter after the input is completed.
After the password modification is completed, restart with the reboot command, and the system will re-enter the default run level.
Thank you for reading, the above is the content of "how to reset root password in Linux single-user mode". After the study of this article, I believe you have a deeper understanding of how to reset root password in Linux single-user mode. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.