What should I do if I forget the Linux password ??

Source: Internet
Author: User
Article Title: What should I do if I forget my Linux password ??. 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 forget the Linux password, there are two cases: one is to start with LILO manager, and the other is not to start through 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 the single user mode, you can use the passwd command to modify your password. after the modification, restart the system and use the new password. The above method is used in Chinese Turbo Linux 3.0.2, but not in Slackware Linux. In the second case, changing the password is troublesome. Linux technical materials and articles published by the relevant media all say that in this case, you must reinstall the Linux system.
  
After repeated exploration, I found that the Linux password can be cleared using the following methods: start with a Linux boot floppy disk. When LILO boot: prompt appears, enter linux mount =/dev/xxxx, xxxx is the partition of Linux, the device name of IDE hard disk is hda, and the first partition is hda1. if your system has two IDE hard disks, the second partition is hdb; if you are using a SCSI hard disk, the device name of the hard disk is sda. Enter the device and partition number of the hard disk correctly, and then start Linux. The system will automatically mount the Linux partition to/mnt. at this time, as long as you enter/mnt/etc, run the vi command to remove the password from the root line in the passwd file. after the system is rebooted, run the passwd command under the super user to generate a new password. The specific modification location is as follows:
  
Root: SDFTYUIIOO34G: 0: 0 root:/bin/bash
  
Delete the underlined content and save the disk, so that the system does not have a password. If your system has two files: passwd and shadow, the password file to be modified is shadow under/etc. it is an image of passwd and a file to store passwords.
  
If your Linux system is of another version and does not recognize linux mount =/dev/xxxx, you can also use the following general solutions: Currently, all versions of Linux have emergency boot disks with disks, there are usually two disks, one of which is the boot disk and the other is the root disk. the names of these two disks are similar in each version. The first few characters are rescxxxx, the suffix is img or gz. What I see is rescboot. img and rescroot. img. After finding these two disks, use the portable img file write command rawrite.exe to write the rescboot. img and rescroot. img files to two floppy disks respectively, and then use these two floppy disks to boot Linux. After booting, run mount/dev/xxxx/mnt under the super user (xxxx is interpreted as above)
  
# Cd/mnt
  
Vi/mnt/etc/passwd
  
Delete the superuser password. The deletion method is the same as above. If your system has both passwd and shadow files, you can solve the problem by modifying only one shadow file. The following figure shows the actual situation of the shadow password file root: Aan3DFTUYOEMF3: 9804: 0 :::::
  
When you use vi to modify the password, you only need to delete the underlined part.
  
  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.