» Generate a moderately secure random password
Just to remind myself...
;)
cat /dev/urandom \ | base64 \ | tr -d '[^:alnum:]' \ | cut -c1-10 \ | head -1The command chain above does the following:
dd if=/dev/urandom
: read random data from/dev/urandom
and write it to STDOUTbase64
: encode that binary data into Base64 to make it human-readabletr -d '[^:alnum:]'
: remove all characters that are not alphanumeric (i.e. remove whitespaces, +, ...)cut -c1-10
: only keep characters 1 to 10 from each linehead -1
: only keep the first line
cat
on /dev/random
instead of /dev/urandom
, if you have enough entropy (see cat /proc/sys/kernel/random/entropy_avail
)
Obviously, if you prefer passwords of a different length, e.g. 16, change the cut -c1-10
accordingly: cut -c1-16
5 Comments:
pwgen isn't good enough? ;-)
I prefer : pwgen -sy 10
Wasn't there a study a while ago that proved that taking the first letter of every word in an English sentence has the same level of security ?
Iwlth3cocN
(I would like to have 3 cups of coffee Now)
Gma2whaE
(Give me a two week holiday after Easter)
Interesting construction but it still casting "+" and "/" chars.
To not to alter "tr" part from "tr -d '[^:alnum:]'" to "tr -d '[^:alnum:][/+]'"
Secure passwords are not just random, but also memorizable. vxrandpw generates such by default.
Post a Comment
<< Home