org generate password
Generate a random password for scratch org users.
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 0 and 5. Each value specifies the types of characters used in the generated password:
0 - lower case letters only
1 - lower case letters and numbers only
2 - lower case letters and symbols only
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”.
| 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: 5Level 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: 20Number of characters in the generated password; valid values are between 20 and 100. 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. |
Generate a password for the original admin user of your default scratch org:
Generate a password that contains 25 characters for the original admin user of the scratch org with alias “my-scratch”:
Generate a password for your default scratch org admin user that uses lower and upper case letters and numbers only:
Generate a password for the specified users in the default scratch org; these users must have been created locally with the “org create user” command: