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.
Walkthrough: Creating a new Super User#
- 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. - Inside the YAML file add
super: trueandpassword: anything_you_want, whereanything_you_wantis literally anything you want as a password. - Visit any URL on the site and Statamic will spot that unencrypted password and hash/securify it for you.
- 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