linux编程 - linux系统下,系统密码忘记了,怎么办?
高洛峰
高洛峰 2017-04-17 14:35:33
0
7
841

就是刚刚安装的系统,没有记住密码。

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(7)
Peter_Zhu

Single-user mode is too troublesome.

The simplest way is to boot from a USB flash drive (any system will do, as long as you have a text editor and supports Linux file system), select a random user in the /etc/shadow file, and change the HASH value of the password field. For
$siicWeap
hld1d7glzP9NCJRxvFDtl5gubgaRM3oWfFfNdDX3mxX1tkhWEUN0UbVYnNziwvkQuB43iDizJ.g9XyKq3wyl0
game, the result is that the password under this username will become

It is recommended to modify the user who has forgotten the password or ROOT, because other users may be system users and cannot log in (knowing the password is useless)
PHPzhong

1. Use the reboot command to restart;
2. Restart and then enter the interface to select the Linux system disk and click space to interrupt the startup;
3. Press E on the keyboard to enter the edit mode. If you want to scroll down the page, find For the kernel line (usually the second to last line), add rd.break at the end, and then press ctrl+x; the system will start again;
4. After starting, execute: mount -a remount on the command line interface, After rw /sysroot is executed, execute chroot /sysroot
5.passwd root. This step changes the root password; 6. touch /.autorelabel, enter exit twice and wait for the machine to start.

Although this method is troublesome, it is safer to use.

黄舟

Add a relatively troublesome method that I have used

  • Use live usb to start the machine, then mount the file system, then chroot;

  • You have already entered the system on the machine as root, and then you can passwd you_user_nameset a password;

左手右手慢动作

Single user mode!

巴扎黑

single mode
passwd root

阿神

Do you know the root password?

左手右手慢动作

If it is a Linux operating system, it is actually very simple - single user login. The following uses Ubuntu14.04 to briefly demonstrate the specific operation process.

  1. Turn on the computer, as shown in the picture below (no virtual machine is installed, the picture taken by the mobile phone is just right):

  2. There will be an option at this time: Advanced Options for Ubuntu, select and press Enter directly,

  3. Seeing that there are many options inside, select the option with recovery mode (don’t press Enter!), press the letter e,

4. The critical moment has arrived. On the fourth line from the bottom, you will see a line of linux /boot/
vm....ro recovery nomodeset,
step 1: Delete recovery nomodeset
step 2: Add quiet splash rw init=/bin/bash

at the end of this line
  1. Press F10 to start.

  2. If nothing unexpected happens, you will enter the system. Enter: passwd. The system will prompt you to enter a new password and end.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template