org generate password

Generate a random password for scratch org users.

Description for org generate password 

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‑versionN/AType: Value

Override the api version used for api requests made by this command
‑‑complexity‑cType: Value
Default value: 5

Level of password complexity or strength; the higher the value, the stronger the password.
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑jsonN/AType: Boolean

Format output as json.
‑‑length‑lType: 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‑bType: 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‑oType: 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”:

1sf org generate password --length 25 --target-org my-scratch

Generate a password for your default scratch org admin user that uses lower and upper case letters and numbers only:

1sf org generate password --complexity 3

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:

1sf org generate password --on-behalf-of user1@my.org --on-behalf-of user2@my.org --on-behalf-of user3@my.org