Article Title: Linux security strategy: fix the Root password of the system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
If you cannot log on to the system because you forgot the root password, try the following methods to change the root password:
Method 1:
1. restart the system. When the system starts to the grub or lilo (usually grub) boot menu, find the current Boot item of the system (you can press the arrow key to expand the hidden menu );
2. Position the cursor on the option and press the "e" key to enter the editing status of the Guide;
3. This option has three lines of statements. Use the cursor to select the second line, that is, the line starting with "Kernel;
4. Press "e" on this line to enter the editing status of this line;
5. Add a space at the end of the row and write the number 1, similar to this:
Kernel/boot/vmlinuz-2.6.9-11.19 ro root = LABEL =/1
6. After modification, press "enter" to return to the original interface;
7. Press the "B" key to start the guide.
In this way, the linux single-user mode can be started, which is a bit similar to the windows security mode.
The most basic systems, network services, and system services are not started.
After the single-user mode guide is complete, there will be # prompt, indicating that you already have super user permissions, and then in #
Run the following command:/usr/bin/passwd
The system should prompt you to enter the password. This password is not displayed, so you can ensure that the input is correct.
After the vehicle is connected, the system requires that the password be entered again. If the entered requirements are the same, a prompt is displayed indicating that the password is successfully modified.
Enter the command init 3 and enter the system character interface mode (the system will change the running level again)
See login: prompt, try again whether you can use root and
Log On with the modified password.
Method 2:
1. Insert the first optical disc into the optical drive and restart the system. After the boot:
Enter linux rescue and press Enter.
2. Follow the Bootstrap program to go down without configuring the network. However, if you want to manually mount the system partition
"Yes", the system enters "#"
Prompt.
3. Run the command chroot/mnt/sysimage/(the default system will be in the/mnt/sysimage/directory)
4. Run/usr/bin/passwd to modify the root password.
5. Execute the command exit, remove the disc, and restart the system.
Then, log on to the system with a new password.
You can fix the root password.