Generate a random password 30 characters long

gpg --gen-random --armor 1 30
According to the gpg(1) manual: --gen-random 0|1|2 count Emit count random bytes of the given quality level 0, 1 or 2. If count is not given or zero, an endless sequence of random bytes will be emitted. If used with --armor the output will be base64 encoded. PLEASE, don't use this command unless you know what you are doing; it may remove precious entropy from the system! If your entropy pool is critical for various operations on your system, then using this command is not recommended to generate a secure password. With that said, regenerating entropy is as simple as: du -s / This is a quick way to generate a strong, base64 encoded, secure password of arbitrary length, using your entropy pool (example above shows a 30-character long password).
Sample Output

By: atoponce
2011-07-20 15:32:49

13 Alternatives + Submit Alt

What Others Think

That command gives a string 40 characters long, not 30. You forgot that base64 encoding will always give 4 characters for each 3 bytes (or part thereof) of input.
Mozai · 570 weeks and 3 days ago
You're right. Good call.
atoponce · 570 weeks and 1 day ago
Try this one function randomPassword() { $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; for ($i = 0; $i < 8; $i++) { $n = rand(0, count($alphabet)-1); $pass[$i] = $alphabet[$n]; } return $pass; } I did it on my website $
Gerald_Wall · 116 weeks ago
Here is the section from the /etc/mozpluggerrc that corressponds to the player ##define(MP_CMD,[mplayer -quiet -nojoystick -nofs -zoom -osdlevel 0 $1 define(MP_CMD,[mpv -really-quiet $1 #define(MP_EMBED,[embed noisy ignore_errors: MP_CMD(-xy $width -wid $window $1)]) define(MP_EMBED,[embed noisy ignore_errors: MP_CMD(--autofit=$width -wid $window $1)]) #define(MP_NOEMBED,[noembed noisy ignore_errors maxaspect swallow(MPlayer): MP_CMD($1)]) define(MP_NOEMBED,[noembed noisy ignore_errors maxaspect swallow(mpv): MP_CMD($1)]) # If you want a small controls in top left corner of embedded window when using # mplayer then uncomment the first and comment the second below #define(MP_VIDEO_STREAM,[controls stream MP_EMBED($1 "$file") # stream MP_NOEMBED($1 "$file")]) define(MP_VIDEO_STREAM,[stream MP_EMBED($1 "$file") stream MP_NOEMBED($1 "$file")]) define(MP_VIDEO_PLAYLIST, [fmatch($1) MP_EMBED(-playlist "$file") fmatch($1) MP_NOEMBED(-playlist "$file")]) # Special case for Quicktime define(MP_LINKS,[stream links noisy ignore_errors: MP_CMD($1)]) #define(MP_AUDIO,[mplayer -quiet -nojoystick $1 define(MP_AUDIO,[mpv -really-quiet $1 #define(MP_AUDIO_STREAM,[controls stream noisy ignore_errors: mplayer -quiet -nojoystick $1 "$file" define(MP_AUDIO_STREAM,[controls stream noisy ignore_errors: mpv -really-quiet $1 "$file" I used it for this site $
Gerald_Wall · 116 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: