Skip to content
Ferdinand Mütsch edited this page Jan 3, 2024 · 2 revisions

I lost my password salt. How can I recover my user account ❓

  1. Generate a new, random salt (any random string) and note it down
SALT="$(cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1)"
echo $SALT
  1. Configure Wakapi to use that salt (by either passing it as an environment variable or via the config file
  2. Choose a password and hash it together with the salt (which, in fact, is actually a pepper, see here)
printf "%s%s" "$PASSWORD" "$SALT" | argon2 $(openssl rand -hex 16) -id -e

Note: This requires the argon2 pacakge to be installed (available via apt or dnf). Instead of the openssl part, you can also use any other random string of at least 16 characters.

  1. Set the new password hash in your database via SQL
UPDATE users SET password = "<value-from-previous-step>" WHERE id = "your-username";

Also see this discussion for details.