Home  >  Q&A  >  body text

linux编程 - linux系统下,系统密码忘记了,怎么办?

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

高洛峰高洛峰2743 days ago827

reply all(7)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 14:37:33

    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)<🎜>

    reply
    0
  • PHPz

    PHPz2017-04-17 14:37:33

    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.

    reply
    0
  • 黄舟

    黄舟2017-04-17 14:37:33

    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;

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 14:37:33

    Single user mode!

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 14:37:33

    single mode
    passwd root

    reply
    0
  • 阿神

    阿神2017-04-17 14:37:33

    Do you know the root password?

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 14:37:33

    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.

    reply
    0
  • Cancelreply