Hack linux system root user password

Source: Internet
Author: User

    • Linux system start-up process

Learn about the Linux system startup process before you explain the root password of the Linux system

1Power-on self-Test (POST), initializing part of the hardware2Search for boot devices that can be used for booting (such as MBR for disks)3read and give control to the system boot loader (GRUB2)4boot loader loader configuration, display available configuration menu5boot loader load kernel and Initramfs, place memory in6boot loader gives control to the kernel7The kernel looks for the hardware driver in Initramfs, and executes it as pid=1 from Initramfs/sbin/Init (in RHEL7, systemd, with Udev daemon8SYSTEMD executes all the Initrd.target units (including mounting the file system to/sysroot)9Kernel root file system switch from Initramfsroot file system to/system root file system on the SysrootTenSYSTEMD Find the default target, and then start all cells of that target

Where, in the 10th step above, "SYSTEMD find the default target (target), and then start all units of the target" in the target refers to the following startup loading unit

    • Hack linux system root user password

The general idea of breaking the root password is that the Linux system will load the Initramfs file system when it starts, and the Initramfs file system is actually compressed with only a small subset of the system commands necessary for boot booting, Before we enter the disk system there will be a system boot loader grub2 to load the kernel and Initramfs file system, because the root password of the disk system is forgotten, so we must modify the boot part of Step 3, tell the system to stop after loading the kernel, Let's go into the Initramfs file system for related operations. When we enter the Initramfs file system, because the current/sysroot is read-only mount, and resetting the passwd will definitely require write permission, we need to re-mount the Write permission. After the last switch root directory is/sysroot directory, the use of the passwd command is the password reset of our disk system, the following:

experimental Environment: a RHEL7 system is installed on the Linux system via KVM to root password hack for the system in the virtual machine

1. Set the root password of the system to an arbitrary value, simulating the situation where you do not know the root password

2. Now start the hack, restart the system after the last step, press the "E" key in the boot Select consignments (following page)

Go to edit page

3. Modify the contents of the RO in the linux16 line (that is, the red line marks) and replace with the Rd.break

Change to the following, then ctrl+x save and proceed to the next step

4. Then go to the Initramfs file system, re-mount the/sysroot, use the RW mode to mount

5. Use the chroot command to switch the shell to/sysroot

6. Use the passwd command now to change the password to the one you want to change. Finally create the/.autorelabel file and tell SELinux to re-mark the file

7. Exit and restart the system with two consecutive exits

8. At this point, the root password has been reset successfully and attempts to log in again.

Hack linux system root user password

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.