Debian forgot root Password solution

Source: Internet
Author: User
Tags versions

This article comes from Chinaunix blog, if you look at the original point: http://blog.chinaunix.net/u/22713/showart_166207.html

Today, I installed Debian to do Linux system programming, and then forgot the root password after loading it. Decisively into the single-player mode to change the password, the result needs to enter the root password.

Google solutions to solve problems, now put Google's solution to prepare for a rainy days

Now we generally use GRUB as the boot program for the system, and Lilo's approach to single-user is simple, and not mentioned here.
For some versions of the OS (for example, Redhat), edit grub, followed by "single", to go into one-user mode. For Debian, however, this approach is not valid because Debian enters single-user mode and requires you to enter the root user's password.
Here's a way to use the grub on all versions of Linux:

1. On the Grub Boot loader menu, select the entry you want to enter, and type "E" to enter edit mode.
2, in the second line (similar to kernel/vmlinuz-2.6.15 ro root=/dev/hda2), type "E" into the editing mode;
3, add "Init=/bin/bash" at the end of sentence, enter;
4, press "B" to start the system.
So we can get a bash shell.
After entering the shell, the mount mode of the root partition is read-only by default, we will change it to writable, otherwise the root password cannot be changed:
Mount-no REMOUNT,RW/
passwd Root
Sync
Mount-no Remount,ro/
Reboot
This will successfully change the Debian root user's password.

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.