SOLVED Set temporary WordPress site admin password in script that automate WordPress installation using WordPress toolkit

crd

Registered
Jan 24, 2022
1
0
1
Canada
cPanel Access Level
Root Administrator
I am using a bash script to automate WordPress sites installation, via command line, using wp-toolkit. How can I set a temporary WordPress site admin password?

The document for WordPress Toolkit Command Line Interface (WordPress Toolkit Command Line Interface | cPanel & WHM Documentation), indicates that ADMIN_PASSWORD environment variable can be used to set password for administrator's username. However, after many attempts I still haven't been able to set a WordPress site administrator's password using the script. Here is the relevant portion of the script that where I try to set the admin password.

/usr/local/bin/wp-toolkit --install -domain-name "mydomain.com" -username "$ID" ADMIN_PASSWORD="${familyName}${ID}" -username "Second admin username" ADMIN_PASSWORD="temporary password for the user"

What option can I use to set the site admin password in the portion of the script shown above? I would appreciate very much your help to resolve this issue.
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,796
1,529
313
cPanel Access Level
Root Administrator
@crd - it looks like your reply came through an email instead of as a post to this page, so I'm going to include a copy of that here to help out other users in the future:

"A technical support technician provided information that helped me to resolve the issue.
Temporary password can be set up by assigning the password to the ADMIN_PASSWORD environment variable and exporting the variable before calling the wp-toolkit command. For example, it can be done as follows:

export ADMIN_PASSWORD="the password"
wp-toolkit --install -domain-name mydomain.ca -username "username" -path "the path"
#Unset the environment variable
unset ADMIN_PASSWORD"