Generate Pronounceable Passwords in Ubuntu Linux with ‘apg’

‘apg’ is a command-line tool (very easy to use) that comes installed by default with Ubuntu that you can use to automatically generate large number of passwords with ease. It comes with two basic ‘modes’. You can use it to create more pronounceable passwords or, passwords that are difficult to remember (as they contain non common characters etc) but are a bit more secure than the pronounceable ones.

The default mode will generate the pronounceable passwords and you can change things like …

*. The minimum and maximum length of passwords.

*. The amount of passwords to generate.

*. Spell or print the complete pronunciation of the generated passwords (helps while memorizing them).

*. Make it include special characters etc for enhanced security and change between the two algorithms (pronounceable and random).

If you have a dictionary file, then you can use it with ‘apg’ to check the strength of the generated passwords against dictionary attacks as well. But since most won’t be needing doing things like that, I’ll skip talking about that.

apg-running-in-Ubuntu

I’m not sure since when Ubuntu started come with it. Enter the below command (just in case) so it’ll be installed if not included already in your OS.

sudo apt-get install apg

How to use it?

Step 1: It’s really easy to use and you can do it in two steps. If you don’t need to change anything manually (most probably don’t need to anyway), then enter the below command to run it (by default it’ll create 6 passwords with 6-11 characters long).

apg

Step 2: As soon as you enter this, it’ll ask you to enter a ‘random data’ that to be used while generating the passwords, such as your old password or a phrase that you’re familiar with for example. And then it will use while generating passwords. I’m not exactly sure why it is there, perhaps it might help to generate a more readable password because it is partially based on a word or a phrase that you’re familiar with (just a guess).

If you don’t like to enter one, then simply press the ‘Enter’ key or if you have one, then type it and then press the ‘Enter’ key.

As soon as you do that, it’ll display you the generated passwords as shown in the above screenshot, that’s it!.

Additional options …

Let’s say that I wanted ‘apg’ to create 3 passwords only, including their spells (disabled by default) and the pronunciation, then I’ll use it in the below order.

apg --n 3 --l --t

The ‘-n’ argument defines how many passwords should be generated, the option ‘-l’ enables spelling and ‘-t’ prints their pronunciation.

Now you’d notice something here and that is, whenever you manually add an argument, ‘apg’ doesn’t ask for you to enter a ‘random data’ anymore. If you never really wanted it then it’s great, however, if you need to enter some text, then you can use the ‘-s’ argument to enable it.

Concerning the above command, I’ll use it in the below format to make it ask me to enter a ‘random data’.

apg --n 3 --l --t --s

Generating random passwords …

As said before, ‘apg’ has two algorithms. One for creating pronounceable ones and other for creating random ones. If you want to create random passwords, then you can use the ‘-a’ argument. The simplest use of it would be to use it as shown below.

apg --a 1

Again, you can combine this with the above commands as well.

That’s pretty much it, good luck.

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

1 thought on “Generate Pronounceable Passwords in Ubuntu Linux with ‘apg’”

  1. The random data is supposed to be random. Not any phrase you’re familiar with. It’s there for security reasons so that it generates the passwords as randomly as possible.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.