English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Solution to Linux Password Forget

Viele Freunde vergessen oft das Root-Passwort des Linux-Systems. Was tun, wenn das Root-Passwort vergessen wurde? Muss das System neu installiert werden? Natürlich nicht! Ändern Sie einfach das Root-Passwort im Einzellbenutzermodus.

Die Schritte sind wie folgt:

Neustart des Linux-Systems

3 Drücken Sie innerhalb einer Sekunde die Eingabetaste, um das folgende Fenster zu erhalten

Geben Sie dann e ein

Geben Sie am Ende der zweiten Zeile single ein, gefolgt von einem Leerzeichen. Die spezifische Methode ist, nach unten zu bewegen und die Taste "e" zu drücken, um in den Bearbeitungsmodus zu gelangen

Fügen Sie am Ende single ein und drücken Sie die Eingabetaste

Drücken Sie zuletzt die Taste "b", nach dem Start ist der Einzellbenutzermodus erreicht

Zu diesem Zeitpunkt sind Sie bereits im Einzellbenutzermodus, Sie können das Root-Passwort ändern. Der Befehl zum Ändern des Passworts ist passwd

Verwenden Sie den Rescue-Modus der System-Installations-CD

Rescue-Modus, kurz rescue,wird hauptsächlich angewendet, wenn das System nicht wie erwartet booten kann. Zum Beispiel, wenn GRUB beschädigt ist oder eine Konfigurationsdatei falsch geändert wurde. Wie verwendet man den Rescue-Modus?

Boot from the CD, press F5 Enter rescue mode

Enter linux rescue and press Enter

Choose language, the author recommends you choose English

Choose us keyboard

Here it asks if you want to start the network, which may be necessary for network debugging. We choose no

Here it tells us that the system will be mounted on/mnt/sysimage

There are three options:

  • Continue means to proceed to the next step after mounting. 

  • Read-Only means to mount in read-only mode, which is safer. Sometimes, in case of file system corruption, read-only mode can prevent further damage to the file system.

  • Skip means not to mount and enter a command window mode. 

Here we choose Continue.

Up to this point, the system has been mounted to/mnt/sysimage. Next, press Enter, and type chroot /mnt/sysimage to enter the administrator environment.

Hint: Actually, you can also change the root password in rescue mode. This rescue mode is very similar to the Windows PE system.

When running chroot /mnt/sysimage/ After that, when you ls again, you will see the directory structure is the same as the directory structure in the original system.

That's right! The current environment is exactly the same as the original system environment. You can enter exit or press Ctrl + D to exit this environment. Then you can ls and take a look

This directory is actually the directory structure under rescue mode, and all our system files are in /mnt/under the sysimage directory.