Linux CentOS Skips admin password for login (single user mode, rescue mode)

Source: Internet
Author: User
Tags administrator password

Here are two ways to change or cancel the Administrator password login to the Linux system, in fact, the two methods are similar, are trying to skip the user identification, directly change the user files, change the password process.

In order to skip some of the steps in the normal startup process of the system, you must know what the approximate system boot process is. The approximate situation is as follows:

  

Single-user mode skips the user authentication from grub, runs bin/sh directly, and then changes the root user password or removes the password.

Rescue mode is to change the boot preferences from the BIOS, boot the system from the system CD, and then come back to change the root user file, to change the password or remove the password.

Law One: single-user mode

Start, you can press a key, space (not a carriage return), let it stay in the following interface

Press E to edit, press the up and down keys to move the cursor to the last page

Add init=/bin/sh after UTF-8

Init=/bin/sh

According to the above prompts, press Ctrl+x to start

sh-4.2# occurs after successful execution

Input Mount-o REMOUNT,RW/(because you want to make changes directly to the file, you must have read [R] and write [W] permissions)

can now change password, use passwd change password, or VI open passwd file, the user password flag x minus, meaning no password.

If the system has SELinux enabled, you need to run the Touch/.autorelabel command, or the system may not boot properly

Enter Exec/sbin/int or exec/sbin/reboot restart

Law II: Rescue mode

Change your preferences to a disc (you must ensure that you have a system image on the disc) to save, restart

Select the last item, "Problem solving"

Select Rescue System

Choose Continue

Select OK, after the system is launched from the CD-ROM this path, the original computer system files placed under the/mnt/sysimage, you can use Chroot/mnt/sysimage to execute the original system program, but after execution need to exit, Again from the CD-ROM this system to restart the computer and other operations.

Chroot/mnt/sysimage executes the original system file, you can use passwd to change the password, or VI to open the passwd file to modify the password flag bit.

Exit the original system, then reboot restart, enter the BIOS to change the preferences back to the hard drive.

Linux CentOS Skips admin password for login (single user mode, rescue mode)

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.