Linux: Forgot password - how it works
If you have forgotten your password for your Linux account, there is no need to worry. You can easily restore it from the terminal.
Recover forgotten Linux password
- Start your computer and hold down the [Esc] or [Shift] key during the boot process to access the boot manager.
- Use the arrow keys to select the Linux entry and press [E].
- You can then edit the boot entry: Add the "init = / bin / sh" addition to the line "linux / boot / vmlinuz ...".
- This will take you to the root terminal. Enter the command "mount -o remount, rw /" and confirm with [Enter].
- Then enter the command "passwd Username". Replace the "Username" section with your user name. If you no longer know this, you can query it using "cat / etc / passwd".
- Since no characters appear on the display, you have to enter your new password "blind". Then confirm your entry with [Enter] and enter your password again.
- Finally, so that Linux actually applies the changes, enter the commands "sync", "mount -o remount, ro /" and "exit" one after the other.
Instead of typing in the codes mentioned, you can also copy the text and paste it into the Linux terminal.