Linux Single user mode change Password method

Source: Internet
Author: User
Tags centos

Forget the Linux password what to do? We can reset the root password using Single-user mode.

However, using Single-user mode has the premise that the system boot (GRUB) works properly, otherwise the repair mode will be used for system maintenance. Special Note: Enter Single-user mode, do not turn on network service, do not support remote connection.

The different running levels (run level) in the Linux system represent the different running states of the system, for example, when the Linux server is running at run Level 3, a multiuser mode that can provide network services, and run Level 1 allows the administrator to operate through a single console of the server host, that is, " Single user Mode ".

My system is CentOS:

Single user mode change Linux password


Enter Single-user mode: There are "a", "E" and "C" three operating buttons in the Grub boot menu, which are available in Single-user mode using these three keys.

Method 1: Use the "a" action button to enter Single-user mode

This is the quickest way to get into Single-user mode. Use the "A" action button in the GRUB boot menu to edit the kernel parameter and enter single at the end of the line to tell the Linux kernel that the subsequent boot process needs to enter Single-user mode and enter.

Method 2: Use the "E" action button to enter Single-user mode

Use the "E" action button in the GRUB boot menu to enter the CentOS boot menu to the interface, move the cursor to the "kernel" configuration entry line, and position the cursor to the Kernel menu item.

Press the "E" key to edit the "kernel" menu item and enter single at the end of the line to tell the Linux kernel that the subsequent boot process needs to go into single-user mode.

The code is as follows Copy Code

Will kernel/vmlinuz-2.6.18-53.el5 ro root=/dev/volgroup00/logvolroot

Change to Kernel/vmlinuz-2.6.18-53.el5 ro root=/dev/volgroup00/logvolroot single

When you change, press ENTER to return to the CentOS Startup menu item interface, and then press "B" to start Single-user mode with the changed CentOS Startup menu item.

Method 3: Use the "C" action button to enter Single-user mode

This is the most cumbersome way to get into Single-user mode, which is typically not used in Single-user mode, which is designed to familiarize yourself with the GRUB command-line interface operation. Use the "C" action key in the Grub boot menu to enter the GRUB command line interface. Use root in GRUB, kernel (enter single at end of line), INITRD command to specify startup parameters, and then boot to single-user mode using the boot command.

Reset Super User Password

A typical application of Single-user mode is the "password setting" of the root user. For some temporary or experimental Linux systems (such as student Labs), the user is often replaced, and the root password may be lost, and the root user's password can be changed into Single-user mode.

The code is as follows Copy Code

sh-3.1 # passwd

Changing password for user root.

New UNIX Password:

Retype new UNIX Password:

Passwd:all authentication tokens updated successfully.

When the system goes into Linux single-user mode, executing the passwd command at the "#" prompt can update the root user's password, and when the system restarts, it can log in to the system using the updated password as root.

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.