On Sat, Nov 23, 2019 at 04:51:28PM +1300, Helmut Walle wrote: > So for recovering your root password stored in the system on the HD... > usually recovering that > password would be a lot of work if possible at all, because passwords are > only stored encrypted > these days. It is usually easier to just delete the password. To do that: > > 1. Boot a rescue system of some sort from a USB medium (or CD / DVD if that's > easier). > 2. Log in as root, or 'sudo su' if you are already logged in (see above). > 3. Mount the partition with your system files somewhere (/mnt usually is > already there and can > be used). > 4. Find the shadow password file where the encrypted passwords are stored > (probably /etc/shadow > - so if you have mounted your HD at /mnt , then it would be /mnt/etc/shadow > 5. Make a backup copy of that file in the same folder, just in case. > 6. Open the shadow file in a text editor, and find the line that begins with > "root". The shadow > file contains the passwords and other parameters for all user accounts, one > account per line > (details available via 'man 5 shadow'). The fields separator is a colon. So > all the gibberish > between the colon after "root" and the next colon is your encrypted root > password... > 7. Delete the entire encrypted root password. > 8. Insert an asterisk '*' between the two colons following "root", where the > encrypted password > was before. > 9. Save the file. > 10. Reboot from HD. Your root password should now be void - so to log in as > root, enter "root" > at the username prompt, and then hit Enter at the password prompt.
Another option is to add the string `rw init=/bin/bash` to the end of the line starting with `linux` in GRUB. Then when the OS loads you'll be dropped directly into a root shell and can type `passwd` to change it to what you want.
signature.asc
Description: PGP signature
_______________________________________________ Linux-users mailing list [email protected] http://lists.canterbury.ac.nz/mailman/listinfo/linux-users
