What to do if you forget your Linux password

If you forget the Linux password, there are two situations, one is to start with LILO manager, and the other is to start without LILO.
If your system is started through the LILO manager, you can enter Linux single at the LILO boot prompt: LILO boot: and then press Enter to start the Linux system and enter single-user mode. At this time, you can use the passwd command to modify your After changing the password, restart the system and you can use the new password. The above methods are passed under Chinese Turbo Linux 3.0.2, but not under Slackware Linux. In the second case, changing the password is more troublesome. The introduction of Linux technical information and the articles published by the relevant media all say that in this case, the Linux system must be re-installed. After repeated exploration by the author, I found that the Linux password can be cleared by the following methods: Boot with the Linux boot floppy disk, when the LILO boot: prompt appears, enter linux mount=/dev/xxxx, where xxxx is the partition where Linux is located, and the IDE hard disk The device name is hda, and the first partition is hda1. If your system has two IDE hard disks, the second one is hdb; if you use a SCSI hard disk, the hard disk device name is sda. After entering the device and partition number of the hard disk correctly, start Linux, and the system will automatically mount the Linux partition to /mnt. At this time, as long as you enter /mnt/etc, use the vi command to remove the password in the root line of the passwd file. After rebooting the system, execute the passwd command under the super user, and regenerate a password, i.e. Umbrella > 咛小芷Na resumed? root: SDFTYUIIOO34G: 0: 0 root: /root: /bin/bash will be underlined After the content is deleted and saved, the system will have no password. If your system has two files, passwd and shadow, the password file that needs to be modified is shadow under /etc, which is an image of passwd and is the file that actually stores the password. If your Linux system is another version, it cannot recognize linux mount=/dev/xxxx, you can also use the following general solutions: At present, various versions of Linux are issued with emergency boot disks, generally there are two, one is the boot disk, the other is the root disk, these two The name of the disk is basically the same for each version. The first few characters are rescxxxx, and the suffix is ​​img or gz. What I see is: rescboot. img, rescroot. img. After finding these two disks, use the IMG file writing command rawrite. exe will rescboot. img, rescroot. img two files were written to two floppy disks, and then use these two floppy disks to boot up Linux. After booting up, execute under super user: mount/dev/xxxx/mnt (the explanation of xxxx is the same as above) #cd/mnt vi/mnt/etc/passwd Delete the superuser password, and the deletion method is the same as above. If your system has both passwd and shadow files, modifying only the shadow file can solve the problem. The following is the actual situation of the root line of the shadow password file: root: Aan3DFTUYOEMF3: 9804: 0::::: When modifying with vi, just delete the underlined part to delete the password.

Guess you like

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