I forgot the root password but backed up the configuration, where is the password stored?

Hi, I forgot the root password but backed up the configuration files, where is the password stored in the backup archive?
If I reset the router by pressing the reset button and restore the backup archive without the uhttp.crt and uhttpd.key files will I have my settings back without the root password?

The password is saved as a hash, not in plain text, in "standard Linux fashion". The plain-text password is "unrecoverable" from the config, as with any "modern" OS.

1 Like

/etc/shadow - and as @jeff said, it's unrecoverable.

Nope. For the desired effect, you just simply restore the config files in /etc/config, generally.

1 Like

If you need to reset the root password, you can boot into failsafe mode, ssh in, mount the overlay, and use passwd to create a new password.

================= FAILSAFE MODE active ================
special commands:
* firstboot	     reset settings to factory defaults
* mount_root	 mount root-partition with config files

after mount_root:
* passwd			 change root's password
* /etc/config		    directory with config files

for more help see:
https://openwrt.org/docs/guide-user/troubleshooting/
- failsafe_and_factory_reset
- root_password_reset
=======================================================
3 Likes

Yes, if you reset password after restoring settings. Uhttpd certs have no role.

You can restore/extract the backup archive to restore all config settings including the password. After restore, but before reboot, you can issue passwd command to set a new root password.
That should achieve your goal.

In practice, the password is in /etc/passwd and /etc/shadow, which you can also overwrite with empty default copies from /rom

Jeff gave another approach, how to reset passwd in failsafe mode (after restoring settings with passwd)

3 Likes