I forgot the linuxroot password. how can I find it?

Source: Internet
Author: User
& Lt; spanstyle = & quot; color: rgb (0, 0, 0); font-family: Tahoma, & 039; M

I haven't played LINUX for a long time. Today, my company's server is down, so I went in and checked it out. The bad thing is that I forgot the password of my company's server or LINUX. I am in trouble, what should we do? I studied it and found out how to find it one morning. The following describes how to find it in three ways:

Break = "style =" word-wrap: break-word; color: rgb (51, 51, 51); text-decoration: none; "target =" _ blank ">

Linux root password retrieval method 1

  

Step 1: When using grub to boot the system: when the grub screen appears, use the up/down key to select the one that you usually start linux (do not select dos), and then press the e key

  

Step 2: use the up and down keys again to select the one you usually start linux (similar to kernel/boot/vmlinuz-2.4.18-14 ro root = LABEL =/), and then press the e key

  

Step 2: modify the command line you see and add single. The result is as follows:

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

  

Step 2: press enter to return, and then press the B key to start, you can directly enter the linux command line.

  

Step 2: run the following command "vi/etc/shadow" to delete the contents of the first line, that is, the line starting with "root", "root", and "next, the first line is similar to root ::...... save

Vi/etc/shadow

  

Step 2: restart reboot. the root password is blank.

 

Linux root password retrieval method 2

  

Step 2: use passwd root to change the status of a single user.

  

Step 2: use the CD to boot the system and run linux rescue to connect the original/partition as follows:

Cd/mnt mkdir hd mount-t auto/dev/hdaX (original/partition ID) hd cd hd chroot./passwd root

 

Linux root password retrieval method 3

  

Step 2: use passwd root to change the status of a single user.

  

Step 2: use the CD to boot the system and run linux rescue to connect the original/partition as follows:

Cd/mnt mkdir hd mount-t auto/dev/hdaX (original/partition ID) hd cd hd chroot./passwd root

  

Step 2: Remove the local hard disk and mount it to other linux systems,


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.