By default, every new scratch orgs have one admin user with no password. Use the generate password CLI command to generate or change a password for any scratch org user.
Generate a password for scratch org admin user
sf org generate password
Generate a password for the specified users
If you want to generate password for other user in your scratch org, add Comma-separated list of usernames or aliases to assign the password to generate.
sf org generate password -b "user1@my.org,user2@my.org"
Generate a password with number of characters
we can also generate password with specific number of characters and what characters to include in your password.
sf org generate password -l 8
Flags:
- -b/--on-behalf-of : Comma-separated list of usernames or aliases to assign the password to.
- -l/--length : Number of characters in the generated password; valid values are between 8 and 100.
Source:
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_org_commands_unified.htm#cli_reference_org_generate_password_unified