NAME
randpass - generate random passwords and passphrases
SYNOPSIS
randpass [ -w | -p NUMWORDS ] [ -s WORDSOURCE ] [ -l WORDLEN ]
DESCRIPTION
randpass generates random passwords and passphrases to your specifications.
OPTIONS
- -w, --word
-
Generate passwords (the default).
- -p, --phrase num
-
Generate passphrases with the specified number of words. The passphrase that is generated will not contain duplicate words (e.g.,
urial hayseed dumpish urial
). This may not be a range.When this option is used, options -c and -C are ignored.
- -n, --count num
-
Generate the specified number of passwords or passphrases. This may not be a range.
- -l, --word-length number-or-range
-
The length of the password, or of each word in the passphrase.
If a range is specified (e.g.,
--word-length 8-14
) then the length of the password (or of the words in the passphrase) will fall randomly within that range (including both endpoints). Half-open ranges (e.g.,--word-length 3-
) are not allowed.The default is 7-14 for passwords and 4-7 for passphrases.
- -c, --chars string-or-setname
-
The set of characters (specified as a sequence of characters) used in generating a password. This is currently ignored if passphrases are being generated.
You may specify a named set instead. Choose among these...
- :std
-
('A'..'H', 'J'..'N', 'P'..'Z', ('a'..'k', 'm', 'n', 'p'..'z') x 2, '2'..'9')
This is the default. It omits digits and letters that may be mistaken for each other (
l
,I
,1
;o
,O
,0
). - :alpha
-
('A'..'Z', 'a'..'z')
- :lower
-
('a'..'z')
- :ALPHA or :upper
-
('A'..'Z')
- :alphanum
-
('A'..'Z', 'a'..'z', '0'..'9')
- :num
-
('0'..'9')
- :hex
-
Hexadecimal digits (lowercase).
('0'..'9', 'a'..'f')
- :HEX
-
Hexadecimal digits (uppercase).
('0'..'9', 'A'..'F')
- :bool
-
Binary digits.
(0, 1)
- :bin
-
Binary data (bytes 0 through 255).
("\x00".."\xFF")
- :bin7
-
Binary data (bytes 0 through 127).
("\x00".."\x7F")
Repeated use of this option is cumulative, so (for example) the following will generate passwords that may be expected to contain (on average) twice as many upper-case letters as lower-case letters:
randpass -c :upper -c :upper -c :lower
- -C, --range begin-end
-
Specify a range of (ASCII) characters to use. As is true of -c, use of multiple -C options is cumulative.
Options -c and -C may be freely interspersed, and the order in which they are given is not significant, so the following are all equivalent:
randpass -c :upper -c :lower -c :num randpass -C a-z -C 0-9 -C A-Z randpass -c :num -c :upper -C a-z
- -r, --required [num#]string-or-setname
-
Specifies that all generated passwords (not passphrases) must have at least num (default 1) occurrences of the characters specified by string-or-setname, which may be a named set (e.g.,
:alphanum
) or a string of required characters (e.g.,aeiou
).For example, the following will generate passwords with at least 2 digits and at least 1 of the given punctuation marks:
randpass -c :alphanum -c '!@%' -r '2#:num' -r '!@%'
Any required characters must be specified in a -c or -C option.
- -M, --maximum-rejects num
-
The maximum number of passwords that may be rejected (default 5,000). If this is exceeded, an error will result.
- -s, --source file
-
Specify the source file from which words will be drawn in generating a passphrase. This file will typically consist of a single word per line (but creative uses of
randpass
may do otherwise for interesting results).The default is
/usr/share/dict/words
. The special file name-
may be used to specify standard input.Note: If the source file doesn't have enough lines (of sufficient length) to generate the full passphrase, the program exits with code 1 and prints a suitable error message to standard error.
- -F, --freli
-
Use the FRELI word list (
/usr/share/dict/freli
when generating passphrases. (See http://www.nkuitse.com/freli/ for more information about FRELI.) - -j, --join string
-
When generating a passphrase, connect the words with the specified string rather than a space.
- -P
-
Uses the author's favorite options by default (
-p 2 -l 3-5
) and adds the option-s /usr/share/dict/freli
if there is a file at that location. - -V, --version
-
Display version information.
- -h, --help
-
Display help.
AUTHOR
Paul Hoffman ( nkuitse AT cpan DOT org )
COPYRIGHT
Copyright 2003-2008 Paul M. Hoffman.
LICENSE
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.