How to Generate Random UNIX Passwords From the Command Line

Tags: , , , , , ,

There are probably a million and one individual pieces of software and websites you can use to generate a randomized password string. But the truth of the matter is that, if you have a UNIX machine, you don’t need them at all! Here’s how to generate a randomized password using widely available UNIX commands.

Random Data

UNIX is really, really good at generating random output. In fact, there is a device dedicated specifically to this cause. Meet /dev/random. We will be using this device as the source of our random password.

What about ASCII?

/dev/random provides us with some *really* random output. If you were to use a section of this random output in its raw form you would likely run into characters that are hard if not impossible to enter with your keyboard. To address this we will use uuencode to convert the raw output into a more human readable base64 version.

Putting it all together

Using dd we can take a small slice of randomness and pipe it into uuencode. The second to last line will be our randomized password.

Note: you may need to install the ‘sharutils’ package onto your system if uuencode isn’t installed by default.

$ dd if=/dev/random bs=1 count=12 | uuencode -m -
begin-base64 644 -
12+0 records in
12+0 records out
12 bytes transferred in 0.000165 secs (72734 bytes/sec)

“dd if=/dev/random bs=1 count=12 ” outputs 12 (count=12) bytes (bs=1) of random data (if=/dev/random).

“| uuencode -m -” This reads the input from the previous command (pipe and trailing -) and encodes it into base64 (-m)

And there you have it, your shiny new random password!

7 Responses to “How to Generate Random UNIX Passwords From the Command Line”

  1. bathroom scale Says:

    If you’re pounding away on it during your workout routine, or if
    kids are scrambling across the surface as they run around their
    jungle gym, you can be sure that you or the children will wear out long before the floor does.
    These watches will influence the behavior of an individual.

    This also eliminates tasting foods for those who cook.


  2. Says:

    Unlike other MMOs, companions in SWTOR are more than just canon fodder: They’re smart,
    helping you out when you need it. Stress test participants will only be able to access the beta between Friday, April 20 at
    12:01 p. Bio – Ware is giving the gaming community a new formula,
    one that’s as different from Wo – W’s model as quantum mechanics is from Newtonian physics.


  3. weighing scales Says:

    As a matter of fact, there are sensors which are essentially used for overload alerts.
    DON’T PANIC if you start to feel yourself getting a little heavier.
    “Insist on quality, brand strategy is the first international background of economic globalization the only way for Chinese enterprises.


  4. Tapping Cidera / Plester Cedera Otot Says:

    Way cool! Somme extremely valid points! I appreciate you writing this post and also the rest of
    the website is really good.


  5. wordpress izrada sajtova Says:

    Hence, it is very critical to decide who to choose for your website development as every company claims to
    have professional expertise and an experienced team of developers.
    Navigation is a very important factor that can determine the success of a website.

    After making a mark with its unmatched designs & development
    strengths, the company is fast emerging as a prominent
    Website Design Company Delhi as well.


  6. graphic design Says:

    ” (if you know a bit about yoga yourself) or “I’ve never tried yoga, would you recommend it.
    Testers notes: Beyond Yoga’s entry reigned supreme for comfort and a soft-as-suede feel, but also for
    creating the illusion of the coveted ‘yoga butt’. The majority
    of women will certainly recognize the value of this, and this
    will take you one step further to your goal.


  7. forex broker Says:

    Greate pieces. Keep writing such kind of info on your blog.

    Im really impressed by your blog.
    Hey there, You have performed a fantastic job. I’ll
    definitely digg it and for my part suggest to my friends.
    I’m sure they will be benefited from this site.


Join the Conversation