5 ms·
You can achieve this with a one-liner: shuf -n 4 /usr/share/dict/words
by ThA0x2 6y ago
You can achieve this with a one-liner:
shuf -n 4 /usr/share/dict/words
- ARandomerDude 6y agoThis is top comment material.
- RandomBacon 6y agoThis reminds me of the infamous Dropbox comment: https://news.ycombinator.com/item?id=9224 https://news.ycombinator.com/item?id=9224
- deleted 6y ago[deleted]
- kelnos 6y ago... which is useless for your average non-technical user who wants to increase their password security but isn't comfortable with a terminal emulator. The main objection I have to sites like this is that they encourage people to use a random untrusted site to generate a password for, say, their bank account.
- 1e-9 6y agoThis may not be cryptographically secure. Shuf can default to using a small amount of entropy.[1,2,3] To be certain, you can add the --random-source option: shuf --random-source=/dev/urandom -n 4 /usr/share/dict/words [1] https://www.gnu.org/software/coreutils/manual/html_node/Random-sources.html https://www.gnu.org/software/coreutils/manual/html_node/Rand... [2] https://github.com/coreutils/coreutils/blob/v8.5/gl/lib/randread.c https://github.com/coreutils/coreutils/blob/v8.5/gl/lib/rand... [3] https://github.com/coreutils/coreutils/blob/v8.32/gl/lib/randread.c https://github.com/coreutils/coreutils/blob/v8.32/gl/lib/ran... Edit: As ThA0x2 points out in a reply, the latest version of shuf uses /dev/urandom to generate a default nonce, which vastly improves upon older versions. As long as your version of coreutils is at least 8.6 or later and your OS has /dev/urandom, the default should be fine. If you don't have /dev/urandom, even the latest version of shuf (version 8.32, as of June 15, 2020) will still default to an insecure nonce.
- deleted 6y ago[deleted]
- dllthomas 6y agoI'm curious how practical an RNG attack actually is here (which absolutely isn't meant to serve as criticism of your surfacing the issue!). In any case, I expect it's much harder than a random "free password gen!" website saving results on the sly (... which is meant to be mild criticism of your framing, but not your recommendation :-p).
- rmrfstar 6y agoDepends on the situation. I definitely wouldn't try this on a freshly booted Raspberry Pi, for example.
- ThA0x2 6y agoshuf uses randint(), which defaults to /dev/urandom as the nonce source: https://github.com/coreutils/coreutils/blob/v8.31/gl/lib/randread.c https://github.com/coreutils/coreutils/blob/v8.31/gl/lib/ran... It's going to be as practical to attack as anything that uses /dev/urandom.
- dllthomas 6y agoFor sufficiently recent versions of shuf. It looks (... at a skim of the history, I could be confused) like older versions use pid, ppid, uid, gid, and time. In that case that's likely to be more practical than brute force if you've generated a password with notionally more than ~40 bits of entropy. That said, I suspect most people are indeed on a platform with a sufficiently recent version of shuf. (And a sufficiently old version may lack the random-source option.)
- ThA0x2 6y agoRHEL 6 will be EOLd this November. That's the last supported version of RHEL that has this issue. Ubuntu 13.04, RHEL 7 and later don't suffer from this issue. I'd say almost everyone reading these comments is on a platform that does not suffer from this issue.
- waynesonfire 6y agoserioludicrous simpleheartedness seminiferal phrenologize no thanks.
- 1e-9 6y agoFor easier-to-remember passphrases, you can download the EFF wordlist from https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt and specify that file instead of /usr/share/dict/words
- deleted 6y ago[deleted]
- noneeeed 6y agoThanks. I had no idea that shuf existed, cool. Another useful tool for my occasional command line work.
- iampivot 6y agoI don't think they'll appreciate you posting the source code to their application!