Root PW problem

Hello:

I run OpenWRT on a WD MyBookLive albeit with a few modifications which made administration much easier.

BusyBox v1.33.2 (2022-02-16 20:29:10 UTC) built-in shell (ash)

The most helpful one was being able to deal with the bad shutdown issues.

Other modifications can be found here at the forum.

Things worked so well that I really did not have much to do and months passed by without any interaction or admin tasks with the MBL.

But Murphy lurks and things happen.
I have forgotten the root/admin password. 8^°

I recall the user log-in password I set up and can log in to perform the usual admin tasks but for the life of me cannot remember the root password and cannot find where I wrote it down.

So it is not as if I am totally locked out.

My only access is via SSH and the UI is disabled.

I'd appreciate some input on how to solve this.

Thanks in advance,

PCL

Boot in generic failsafe and reset the root password with the passwd command?

Hello:

Boot in generic failsafe and reset ...

No, I don't think it is possible with this OpenWRT installation.

The hardware is a MyBookLive NAS - Single version. See Failsafe Mode, Factory Reset, and Recovery Mode.

Caveat: Failsafe mode is only available if you have installed firmware from a SquashFS image ...

So:

user@OpenWrt:~$ grep squash /proc/mounts
user@OpenWrt:~$

I was thinking that since I have an etc/sudoers.d file, which I cannot edit atm because I don't have the root PW, there could be a way out of this.

Maybe if I take out the HDD, mount it in my main box and see if I can edit the etc/sudoers.d file to get me access to what I need to get out of this via sudo.

Like sudo su - ....

Any suggestions?

Thank you for your input.

Best,

PCL

If you can do that, you better modify /etc/shadow which keeps the encrypted passwords.

root@OpenWrt:~# cat /etc/shadow | grep root
root:$1$xyz$IR1KrndabVa9JyIuPkcpH0:19243:0:99999:7:::

The string between the first and second colons (:) is the password.

Generate a new hashed password using openssl passwd command

root@OpenWrt:~# openssl passwd -1 -salt xyz your_new_pass_here
$1$xyz$nKNjAgEzzJ2lDCIcfbzEq0

and insert the result between the first and second colons after root.

In my experience, the easy way of just removing the content between the two colons (which means no password) doesn't always work, so better spend more time generating a new password to avoid disassembling the device twice.

2 Likes

Hello:

Yes!
Thank you very much.
Problem solved in a under a minute.

Just in case there was something version wise that could not be running right, I just copied my user PW line and edited it to be the root PW line, as I am absolutely sure that it worked.

I can now (temporarily) access both accounts with the same PW.
This will change right after I solve the problem caused by a bad shutdown as I need root access for that.

Once again, thank you very much for your input.

Best,

PCL

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.