Skip to content Skip to footer navigation

Creating Users by Hand

Create CP users by adding YAML files to the users directory — Statamic encrypts the password on first load.

User accounts are represented by YAML files in the users/ directory, named according to their email address. The YAML contents must have a password and role of some kind inside to be able to log into the control panel. The simplest role is a Super User.

Hot Tip!

You can also create users via the command line. It's even easier than this.

A troll pointing a teaching stick

Walkthrough: Creating a new Super User#

  1. Create a file called <[email protected]>. Make sure to use a real email address otherwise that reset password feature won't do a darn thing.
  2. Inside the YAML file add super: true and password: anything_you_want, where anything_you_want is literally anything you want as a password.
  3. Visit any URL on the site and Statamic will spot that unencrypted password and hash/securify it for you.
  4. Now you can log in with anything_you_want, or the thing you really wanted.

Before being securified:

super: true
password: anything_you_want

After securification:

super: true
password_hash: $2y$10$Vopn8T7e.EMVEjxdP5p.g.AU5GTTN4RklvgR2l0dTwSPeJal91v/q

Assigning Non-Super Roles#

If you've created roles with limited permissions, you can assign those to your user's YAML file in an array:

roles:
- editor
- publisher