Having a strong password 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.
### Generate a strong password with openssl
This method uses the openssl rand function and it will generate 14 characters random string:
```
openssl rand -base64 14
```
### 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:
```
< /dev/urandom tr -dc A-Za-z0-9 | head -c14; echo
```
### Generate a strong password with pwgen
`pwgen`is a tool that generates random, meaningless but pronounceable passwords.
To install`pwgen`run:
```
sudo apt-get install pwgen
```
Once the installation is complete, use the following command to generate a random string of 14 characters: