Restore the password under Linux
Renewing a password under Linux is relatively easy if the root is or wants to change his own password. In principle, this happens as root with
or for your own password
It will not be that easy if you can no longer log in to the computer and thus is not logged in. The fastest method is via the Grub bootloader.
- To do this, use the [arrow keys] to select the desired boot entry in the pit (this is usually the one that is automatically preselected).
- then press [e] to edit the entry. One comes now in the area by the boot parameters are.
- Now use the [arrow keys] to select the line with the Linux kernel (linux) and then click on the [end] key at the end of the line. Here you insert init=/bin/bash and make sure that a space is inserted to the previous parameter. With the [F10] key you can boot into the system with this entry.
- You are now in a read-only embedded root file system. To integrate this writable (rw), use this command.
mount -n -o remount,rw / /
sets you now a new password. You should keep it as small and simple as possible, because we have set the US-American keyboard here. And later in the production system you can finally set the password with the same command.
- Finally, set the file system back to read-only so that it is safely in a consistent state before the reboot:
mount -n -o remount,ro / /
- Now restart the system with a
The option -f becomes necessary during the reboot, because it has to be forced by the missing init daemon, since no normal reboot is possible.