Skip to content
Kosh Docs

kosh generate

Generate a cryptographically random password and save it as a credential.

Generate a cryptographically random password and save it as a credential.

Terminal window
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.

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 get or kosh search.
  • With --no-save the password is copied to the clipboard, nothing is written to the vault, and no master password is requested.
Terminal window
# Generate and save a default 20-character password
kosh generate github alice
# Generate a 32-character password with strict requirements
kosh generate -l 32 --require "upper=2,lower=10,digit=5,symbol=3" email alice
# Generate a password without symbols
kosh generate --symbol=false server root
# Copy a throwaway password to the clipboard without saving it
kosh generate --no-save