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

What if I forget the password of the linux system?

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

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "linux system password forgot how to do", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "linux system password forgot how to do" it!

This paper passed the test on rh8.

one。 Lilo

1. Type linux single at the lilo: prompt

The screen shows lilo: linux single

two。 Enter can directly enter the linux command line

3. # vi / etc/shadow

Delete the first line, which begins with root, after root: and before the next:

The first line will be similar to

Root::.

Save

4. # reboot restart, root password is empty

two。 Grub

1. When the grub screen appears, use the up and down keys to select the item in which you normally start linux (do not select dos yo), and then press the e key

two。 Once again, use the up and down keys to select the item where you normally start linux (similar to kernel / boot/vmlinuz-2.4.18-14 ro root=LABEL=/), and then press the e key

3. Modify the command line you see now, add single, and the result is as follows:

Kernel / boot/vmlinuz-2.4.18-14 single ro root=LABEL=/

4. Enter and return, then press b to start, and you can directly enter the linux command line.

5. # vi / etc/shadow

Delete the first line, which begins with root, after root: and before the next:

The first line will be similar to

Root::.

Save

6. # reboot restart and the root password is empty.

The following is the supplement of other netizens, you can refer to:

First, enter single-user mode

1. Boot the floppy disk using the Linux system

If you have created a boot floppy disk for the Linux system and set the computer system to boot from the floppy disk, enter: boot: linux single system into the single-user mode with the prompt "#" when the boot prompt is displayed, and the computer boot runs at a level of

1. The local file system is mounted, many system services are not running, and all system authentication is skipped. A system administrator uses a specific machine to mount the root file system as read and write. You can use:

(1) passwd program to set the new password of root

# passwd root

# reboot

The root password has been updated after rebooting the system.

(2) delete the password of root by modifying the / etc/shadow file

# cd / etc

# vi shadow

Delete the content after "root:" and before the next ":" in the line that begins with root.

The first line will look like "root::?", restart the system after saving, and leave the root password blank.

two。 Start with LILO multi-system bootstrap

When the system starts with the LILO bootstrapper, enter at the LILO prompt:

LILO: linux single

After entering a single user, the method of changing password is the same as 1.

3. Start with GRUB multi-system bootstrap

Use GRUB to boot the system into a single-user step:

(1) start GRUB, select the option of Red Hat Linux, and then type e to edit;

(2) Select the line that begins with kernel, and then press the e key. At the end of the line, press the space bar and enter single to exit the editing mode with the enter key.

(3) after returning to the GRUB screen, type b to boot into single-user mode. After entering a single user, the method of changing password is the same as 1.

Use the Linux system installation disk

If you do not make a system boot floppy disk, and the multi-system boot LILO and GRUB are deleted (such as after reinstalling the Windows system), then you can only use the Linux system installation disk to restore the root password.

Start with the first Linux system installation disk and enter at the boot prompt:

 oot: linux rescue

At this point, the system enters rescue mode and then follows the prompts to complete:

1. Choose the language and keyboard format;

two。 Choose whether to configure the network card, the general system because the network does not need, so you can choose whether to skip the network card configuration;

3. Choose whether to let the system look for the Redhat Linux system on the hard disk and choose to continue.

4. The system shows that the system on the hard disk has been found and mounted under / mnt/sysimage.

5. If you enter the rescue state, you can reset the password of root:

# chroot/mnt/sysimage (make the system the root environment)

# cd / mnt/sysimage

# passwd root

Thank you for reading, the above is the content of "the password of the linux system forgot how to do". After the study of this article, I believe you have a deeper understanding of the problem that the password of the linux system has forgotten how to do it, and the specific use needs to be verified in practice. 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.

Share To

Servers

Wechat

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

12
Report