By default, new scratch orgs contain one admin user with no password. Use this command to generate or change a password for this admin user. After it’s set, you can’t unset a password, you can only change it.
You can also use the –on-behalf-of flag to generate a password for a scratch org user that you’ve created locally with the “org create user” command. This command doesn’t work for users you created in the scratch org using Setup.
To change the password strength, set the –complexity flag to a value between 3 and 5. Each value specifies the types of characters used in the generated password:
3 - lower and upper case letters and numbers only
4 - lower and upper case letters and symbols only
5 - lower and upper case letters and numbers and symbols only
To see a password that was previously generated, run “org auth show-user-password”.
Flags
Flag Name (Long)
Flag Name (Short)
Description
‑‑api‑version
N/A
Type: Value
Override the api version used for api requests made by this command
‑‑complexity
‑c
Type: Value Default value:5
Level of password complexity or strength; the higher the value, the stronger the password.
‑‑flags‑dir
N/A
Type: Value
Import flag values from a directory.
‑‑json
N/A
Type: Boolean
Format output as json.
‑‑length
‑l
Type: Value Default value:20
Number of characters in the generated password; valid values are between 20 and 1000. Default value is 20.
‑‑on‑behalf‑of
‑b
Type: Value
Comma-separated list of usernames or aliases to assign the password to; must have been created locally with the “org create user” command.
‑‑target‑org
‑o
Type: Value Required
Username or alias of the target org. Not required if the target-org configuration variable is already set.
Examples for org generate password
Generate a password for the original admin user of your default scratch org:
1sf org generate password
Generate a password that contains 25 characters for the original admin user of the scratch org with alias “my-scratch”: