We’ll show you, How to generate a strong password from the command line in Linux. Having a strong password in Linux, is the most important thing you can do to protect your account or server and to keep your data secure. Common thinking is that a strong password should be comprised of at least 14 characters, including lowercase and uppercase alphabetic characters, numbers and symbols and should never be based on a dictionary word. Using a long password is much more secure that using a short one, the longer the password the harder it is to guess. In this post, we will take a look at a several different ways to generate a strong password using the Linux command line.
Table of Contents
1. Generate a strong password with openssl
This method uses the openssl rand function and it will generate 14 characters random string:
2. Generate a strong password with urandom
In this method we will filter the /dev/urandom
output with tr
to delete unwanted characters and print the first 14 characters:
3. Generate a strong password with pwgen
pwgen
is a tool that generates random, meaningless but pronounceable passwords.
To install pwgen
run:
Once the installation is complete, use the following command to generate a random string of 14 characters:
You can also use some of the following flags:
4. Generate a strong password with gpg
We can also use the gpg
tool to generate a strong 14 characters password:
Of course, there are many other ways to generate a strong password. For example, you can add the following bash shell function to your ~/.bashrc
file:
and when you need to generate a strong random password just type genpasswd
If you have any questions regarding the process of generating a strong password from the command line, feel free to comment below or sign up for our hosting services and contact our EPIC Support Team. They are available 24/7 and they will take care of your request immediately. You can always asks our support team to generate a random and strong password from the command line in Linux, for your.
PS. If you liked this post on how to generate a random password from the command line in Linux, please share it with your friends on the social networks using the sharing buttons or simply leave a reply below. Thanks.
Hi there,
just to share the information, i noticed that the solution 4 based on “gpg –gen-random –armor 1 14” often gives passwords ending by “=”.
So i would’nt say it’s “fully random”. But anyway, it’s better than nothing or a fully manual process.
Best Regards