How do you create Admin user via CLI?

System Information
  • Strapi Version: 3.6.2
  • Operating System: Fedora
  • Database: Sqlite3
  • Node Version: v14.17.0
  • NPM Version: 6.14.13
  • Yarn Version: v1.22.10


I found the docs to change the admin password @ cli, but nothing so far on how to CREATE the Admin user in the 1st place @ cli. It works ok from the browser, but I’d like to script it.

What’s the cli/shell method to create the STrapi Admin user?




Did you ever find out how to do it? I’d like to know as well.

I also would like to do the same for my requirement

You could automate the creation of the admin user by putting this snippet in the bootstrap function of your Strapi project.

Alternatively you could create your own CLI that runs this code.

npm run strapi admin:create-user --firstname=YourFirstName --lastname=YourLastName --email=YourEmail --password=NewPassword

Important correction for all those coming here over Google:

npm run strapi admin:create-user -- --firstname=YourFirstName --lastname=YourLastName --email=YourEmail --password=NewPassword

With the two dashes before the options, they are given to admin:create-user instead of npm run