kosh generate
Generate a cryptographically random password and save it as a credential.
Generate a cryptographically random password and save it as a credential.
kosh generate [label] [user] [flags]Arguments: a label and a user, both required — unless --no-save is passed, in which case both
may be omitted.
| Flag | Description | Default |
|---|---|---|
-l, --length int |
Length of the password | 20 |
--upper |
Include uppercase letters | true |
--lower |
Include lowercase letters | true |
--digit |
Include digits | true |
--symbol |
Include special symbols | true |
-r, --require string |
Password requirements, e.g. upper=2,digit=3 |
|
-n, --no-save |
Generate password but do not save it | false |
Boolean flags are enabled by default and are disabled with the explicit --flag=false form.
Requirement groups
Section titled “Requirement groups”| Group | Description |
|---|---|
lower |
Lowercase letters |
upper |
Uppercase letters |
digit |
Digits |
symbol |
Special symbols |
- Requiring characters from a group that has been disabled is rejected.
- If the required counts add up to more than
--length, Kosh asks whether to grow the password to fit them. - Saving a password does not print it. Retrieve it later with
kosh getorkosh search. - With
--no-savethe password is copied to the clipboard, nothing is written to the vault, and no master password is requested.
Examples
Section titled “Examples”# Generate and save a default 20-character passwordkosh generate github alice
# Generate a 32-character password with strict requirementskosh generate -l 32 --require "upper=2,lower=10,digit=5,symbol=3" email alice
# Generate a password without symbolskosh generate --symbol=false server root
# Copy a throwaway password to the clipboard without saving itkosh generate --no-saveSee also
Section titled “See also”- Storing Credentials — the guide, with worked examples