Password Generator for Linux

Having strong passwords keeps your account and systems safer. Along with strong password, it is always advisable to have Multi-Factor-Authentication (MFA).

Let us see how to generate strong passwords in Linux systems.  “pwgen” utility in Linux, generates passwords which are designed to be easily memorized by humans, while being as secure as possible. The pwgen program is designed to be used both interactively, and in shell scripts. Hence, its default behavior differs depending on whether the standard output is a tty device or a pipe to another program.

Install pwgen

I am using a Fedora Linux system and will be using “dnf” package manager to install “pwgen”. If you are using other variants of Linux, use the respective package managers.


Usage of pwgen

Here are the supported options with “pwgen” command.

Generating a strong password in Linux

Let us generate a password of 12 characters, with atleast 1 Capital letter, 1 number and 1 symbol. Here is the command to generate it. This will generate multiple passwords based on your input criteria and will display it in columns. You can pick any one that you want to use.

If you need to generate a single password, so that it can be used in scripts – you can use the below command.

Be sure to play with other options of this command to generate password based on your needs.