Generate a Random String

This is useful for when an application requires a “app secret”. (LibreNMS, Zitadel, etc.)

tr -dc A-Za-z0-9 </dev/urandom | head -c $(LENGTH); echo

Where $(LENGTH) is the desired size of the string.

For example, Zitadel requires a 32 character “Master Key”:

tr -dc A-Za-z0-9 </dev/urandom | head -c 32; echo >> master.key