[Linux] Practical Instructions: Runlevels and Retrieving the Root Password

command run level

0: shutdown

1: Single User (Retrieve lost password)

2: Multi-user without network service (less used)

3: Multiple users have network services (the most used)

4: Reserved

5: Graphical interface

6: reboot

System's runlevel configuration file:

/etc/inittab

Commands that specify runlevels

init [012356], be careful not to use 4: keep

Example: 5 –> 3 –> Shutdown

vim /etc/inittabView the operating sector: id: 5

Example: How to retrieve root password

Ideas: Enter single-user mode, and then change the root password.

Because of entering single-user mode, root can log in without entering a password.

Demonstration: [Shang Silicon Valley_Han Shunping_Linux Tutorial]( https://www.bilibili.com/video/av21303002/?p=22
)
Steps: Boot -> Enter the Enter key during boot -> see an interface input e->When you see an interface, select the second line (edit kernel)

Enter e -> enter 1 at the end of this line, enter the Enter key -> enter b again, then you can enter single-user mode

This is, we enter single-user mode and use the passwd command to change the password.

Note: To modify the password, it must be modified locally and cannot be modified remotely.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325478132&siteId=291194637