Sometimes you’re in the need for creating a secure password, but don’t want to think of one and don’t want to use your default password for everything. And exactly a t the moment you forgot how to invoke
sed to get one by yourself from
Here comes mkpassword. As easy as creating a new folder with
mkdir you can create a new password with
There isn’t actually much to configure. You can define the length, the type and the output options.
$ mkpassword -h Usage: mkpassword [options] Options: --version show program's version number and exit -h, --help show this help message and exit -v, --verbose Verbose output -l N, --length=N password lenght in characters -s X, --salt=X use X as salt -c, --config-secure skip some problematic characters -n, --no-colors don’t use colored output -a, --alpha-numeric only use letters and numbers -q, --quiet only output the password
… and no, the salt isn’t actually a salt, it’s more like adding a bit more preference on some characters. The
-c parameter filters out the characters
" that are usually problematic in a lot of configuration files (escaping and stuff). Length of password defaults to 20 characters.
This is the simplest call possible. It uses all default values and generates a 20 characters long password using all printable characters except newlines and any kinds of white-spaces.
When creating config-secure passwords it’s possible that some of the characters are removed reducing the length of the created password. Speaking of characters: If you use lower lengths you’ll get a little warning. The passwords may still be secure, but creating config-secure passwords could reduce the security of very short passwords.
If you’re forced to use passwords only containing numbers and letters for some reason, blame the person of charge and simply use parameter
-a until that security hole is fixed ☺
Even if longer passwords only containing alpha-numeric characters are considered rather secure, you should really only use this type of password if there is no other way … But what if you can’t use mkpassword at all, because it fails at some point (or you just want to know what it does)?
This rather complex example shows some of the already known parameters combined with
-v for printing verbose messages. All the gray messages in brackets are internal function calls or informations about actions are done before giving the putput. Use this lines as guide if the programm fails and please report that to me, thanks!
This very reduced output (no colors, no messages) is caused by the parameters
-n combined. It only prints the password without color codes. This can be useful if you want to use
mkpassword within a script and only need the password output. All other parameters are working here, too.
If you’re an Arch Linux user, see mkpassword-git in AUR. The AUR package uses the most recent GitHub sources.
See GitHub for details. All my code is available under GPLv3 or later.