Command line tool to generate memorable passwords?

21

4

I’m looking for a tool, command line or GUI, for Linux that generates memorable passwords.

An equivalent of what I am looking for would be passwords that the Mac OS X keychain can generate, something like apples12$/fourteen. Something strong, but easily memorized by a user.

James McMahon

Posted 2011-01-24T18:36:09.233

Reputation: 3 010

Answers

22

I've since moved on to XCKD style passphrases for most of my passwords. Here is a 1 liner from commandlinefu to generate a passphrase:

shuf -n4 /usr/share/dict/words | tr -d '\n'

James McMahon

Posted 2011-01-24T18:36:09.233

Reputation: 3 010

2actually, there is an issue with this one-liner: it may use words like "the", "them", "their" and "moat", "iris", "he". Do you see the problem? There's an overlap between prefixes and suffixes, which reduces the actual entropy of the generated password and can lead to pretty weak passwords if the strings are not long enough (especially with 4 words). This is why word-based password generators use crafted word lists. Granted, passwords generated with the above are pretty good: 14 chars minimum in my tests, with a median size of 34. But their entropy is not reliable. – anarcat – 2017-08-31T19:13:12.153

What is the the issue with having overlapping prefixes / suffixes? I can understand your point about length, but you'll need to explain the other point. – James McMahon – 2017-09-12T02:20:16.000

let's simplify to the extreme. you have a dictionnary made out of three words: the, me and theme. normally, you would expect you'd have the entropy equally from those three words, but in this case, you can't count theme because it is a combination of the other two words. in effect, theme actually adds zero entropy to the password. – anarcat – 2017-09-12T14:07:04.817

But isn't "the me" distinct from "theme"? I get that possible letters add entropy but this approach is more about the size of passwords. I don't get how "the me theme" would be easier to guess then a sequence with no overlapping characters like "do ray music" – James McMahon – 2017-09-13T00:15:37.643

the me isn't distinct from theme because you do not separate the words with spaces. the number of letters adds a certain amount of entropy, assuming that the attacker doesn't know how you generate your password. you can't assume that, especially if you publicly post about it. in that case, you must compute how much each word from the dictionary contributes to the entropy, and that's a different algorithm. as i mentioned here, i wrote a detailed article about how to evaluate that... – anarcat – 2017-09-14T01:49:26.157

I like to use words of medium length that aren't obscure. So here's my variation of the answer: curl -s "https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-usa-no-swears-medium.txt" | shuf -n4 | tr -d '\n'. It requires you to be online to download the word list but the password generation itself is offline. – nofinator – 2019-05-01T17:30:18.800

@anarcat I'd like to read your answer. I appreciate the other info you've provided so far. Will check out xkcdpass. – wbg – 2019-11-18T04:11:39.533

1

@wbg my answer is here https://superuser.com/a/1246245/177019

– anarcat – 2019-11-19T14:55:16.037

11

2020: I posted this answer in 2011. In the years that have passed, the face of cyber security and the demands to it have changed rapidly and enormously. As has been pointed out by anarcat, pwgen may not (or no longer) be suitable for securing high-security systems. He sets out to describe the technical details on how pwgen can, in some circumstances, use insecure methods of password derivation from available entropy in his article. Although I no longer believe in generating passwords to then try and remember them myself, I do not have the technical aptitude to validate, let alone vouch for the contents of the article as quoted so please read it and draw your own conclusions. Having said that, I am convinced that pwgen will suffice for low-security systems where attack is very unlikely.

You might want to check out the pwgen application. I know it to be available in the Ubuntu, Fedora, Debian and Suse repositories.

From the man page:

The pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible. Human-memorable passwords are never going to be as secure as completely completely random passwords. In particular, passwords generated by pwgen without the -s option should not be used in places where the password could be attacked via an off-line brute-force attack. On the other hand, completely randomly generated passwords have a tendency to be written down, and are subject to being compromised in that fashion.

The pwgen program is designed to be used both interactively, and in shell scripts. Hence, its default behavior differs depending on whether the standard output is a tty device or a pipe to another program. Used interactively, pwgen will display a screenful of passwords, allowing the user to pick a single password, and then quickly erase the screen. This prevents someone from being able to "shoulder surf" the user's chosen password.

BloodPhilia

Posted 2011-01-24T18:36:09.233

Reputation: 27 374

4pwgen passwords have serious security issues by default, and are not very memorable. use diceware or xkcdpass instead. – anarcat – 2017-01-30T20:01:56.987

@anarcat, what are the serious issues that you mentioned? Please add some more details. – Carl Winbäck – 2020-01-03T14:29:28.747

as i said in an answer here and a comment above, see https://anarc.at/blog/2017-02-18-passwords-entropy/

– anarcat – 2020-01-04T15:59:56.190

1@anarcat thanks! I agree pwgen may not be the best option (anymore) but I will leave my answer with the disclaimer I added to address your concerns in place for historical purposes. – BloodPhilia – 2020-01-04T20:05:32.213

3Passwords like 'Zei7jool' or 'Oowee6ei' don't seem very memorable to me. Perhaps I am missing a flag? – James McMahon – 2011-01-24T18:44:12.607

3@James They are generated according to an algorithm that puts letters in a non-sense, yet because they are logical in human linguistics, rememberable order. You'll probably have to make a similar effort to remember the apples12$/fourteen password. Just give it a try. – BloodPhilia – 2011-01-24T18:47:44.073

1It spews out a giant list of passwords, just choose the most memorable -- there are some gems in there ;-) – virtualeyes – 2013-03-27T12:07:09.627

8

I would recommend people stop using pwgen - its main interested was generating "human-rememberable passwords", but it showed multiple vulnerabilities in doing exactly that. And using it to generate completely random strings isn't that useful either.

I wrote a detailed article on that very topic, but basically, the gist of it is to use the diceware program (or, if you like dice, the actual diceware system) or xkcdpass. To generate strong memorable passwords, I generally use diceware with the following configuration file:

[diceware]
caps = off
delimiter = "-"
wordlist = en_eff

Examples:

$ diceware
turkey-eligibly-underwire-recite-lifter-wasp
$ diceware
lend-rubdown-cornflake-tint-shawl-ozone
$ diceware
syndrome-ramp-cresting-resolved-flinch-veneering
$ diceware
alto-badass-eclipse-surplus-rudder-quit

I turn off caps and spaces because they generate distinct audible noises that could be leveraged by an attacker. The - delimiter is a lesser evil: it would be better to not use any separator and the en_eff wordlist is especially crafted for that purpose. But I find it easier to communicate and share passwords when they have some separator.

To generate a completely random password, I use the following shell function:

# secure password generator or, as dkg puts it:
# high-entropy compact printable/transferable string generator
# a password generator would be pwqgen or diceware
pwg() {
    ENTROPY=${1:-20} # in bytes
    # strip possible newlines if output is wrapped and trailing = signs as they add nothing to the password's entropy
    head -c $ENTROPY /dev/random | base64 | tr -d '\n='
    echo
}

I mention this because I believe it is important to memorize less passwords and instead rely on a password manager to store large strings that are hard to guess. More details about the rationale behind those choices is explained in the aforementioned article and my password managers review.

anarcat

Posted 2011-01-24T18:36:09.233

Reputation: 351

4

Try 'gpw'. It produces passwords such as these: ubsonsin morimplo demenump esselymn kidentst anenterg essonsuf iesssssi bestruss tnestese

Description: Trigraph Password Generator This package generates pronounceable passwords. It uses the statistics of three-letter combinations (trigraphs) taken from whatever dictionaries you feed it. Thus pronounceability may differ from language to language. Based on the ideas in Morrie Gasser's password generator for Multics, and Dan Edwards's generator for CTSS. FIPS Standard 181 describes a similar
digraph-based generator, derived from Gasser's.

Thomas

Posted 2011-01-24T18:36:09.233

Reputation: 265

1

A good option that has popped up since I asked this is Redacted's XKCD-password-generator.

It's a nice Python script to generate XKCD style passwords that has some advance options like acrostic support.

James McMahon

Posted 2011-01-24T18:36:09.233

Reputation: 3 010

0

sf-pwgen is a command line tool which generates passwords using the SecurityFoundation framework in OS X.

vdm

Posted 2011-01-24T18:36:09.233

Reputation: 191