Created
November 20, 2021 22:55
-
-
Save schams-net/a44343713993ad6a78bdafedae46e4a2 to your computer and use it in GitHub Desktop.
Set a new BE user password (Argon2-hashed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RANDOM_PASSWORD=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w16 | head -n1) | |
ARGON2_PASSWORD=$(php -r "echo password_hash('${RANDOM_PASSWORD}', PASSWORD_ARGON2I, ['memory_cost' => 64000, 'time_cost' => 30, 'threads' => 4]);") | |
echo -e "Password:\t${RANDOM_PASSWORD}\nArgon2 Hash:\t${ARGON2_PASSWORD}" | |
mysql -e "UPDATE be_users SET password = '${ARGON2_PASSWORD}' WHERE uid = 1" | |
mysql -e "SELECT uid, username, password FROM be_users WHERE uid = 1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment