Hi all,
Firstly, please excuse me if I sound a bit exasperated. So… some time back I reluctantly enabled Server Side Encryption to support two modules that required it (passwords
and otpmanager
).
I neglected to set up a recovery key (my fault), and I have a user that has forgotten their password. Except, I cannot change the password: in the admin UI, there’s no means to change the user’s password, the user has no email address set (so they can’t use the “forgot password”), and I can’t set an email address (it just ignores me and the email field stays blank … nothing in the logs).
From the command line, occ user:resetpassword
prompts “are you sure”, I answer y
, and type a new password in twice at its request (not an existing password, a new password)… then it complains maybe I “provided the wrong password”.
host:~# occ user:resetpassword theuser
{"reqId":"OW5LEXZQHBQzej0B1Siy","level":1,"time":"2025-05-04T04:25:44+00:00","remoteAddr":"","user":"--","app":"admin_audit","method":"","url":"--","message":"Console command executed: user:resetpassword theuser","userAgent":"--","version":"30.0.8.1","data":{"app":"admin_audit"}}
Warning: Resetting the password when using encryption will result in data loss!
Do you want to continue?y
Enter a new password:
Confirm the new password:
Can not decrypt the recovery key. Maybe you provided the wrong password. Try again.
How? It asked for a new password, I gave it a new password. How does it know it is “wrong”? It didn’t ask for a recovery key, it asked for a new password, which by definition of being new, is not known to the system in any way shape or form. Otherwise it wouldn’t be a new password would it?
If it wants an existing secret, it should ask for the existing secret, and not a new one.
So clearly, it is trying to recover a secret encrypted with a password no one has. Easiest thing, is to take back-ups of the critical files, then blow the lot away and re-start. Accept the loss and move on.
I’ve taken a back-up of all encrypted files: in my password manager (pass
) I have JSON back-ups of the data from passwords
and otpmanager
. I am willing to destroy all encrypted data in the server and re-create them from these back-ups.
I tried doing a occ encryption:disable
then an occ encryption:enable
… somehow when I re-load passwords
or otpmanager
in my browser, the secrets persist, so clearly that did not delete the encrypted data like it ought to have.
So the question, how do I restore this system to a state of “has no encrypted data”, so that I can generate new root encryption secrets, set up a new recovery key, re-import the exported backups, and re-share these secrets and finally reset this guy’s password?
Alternatively, is there a way to blow away and re-create the user’s “recovery key”? Again, the only thing encrypted is these passwords and TOTP secrets, I can re-share them with the user. Nothing will be lost that isn’t recoverable by other means external to NextCloud. How do I reset this?