Generate Random Password in Linux – Command Line

There are plenty of ways to make your password secure, but most people just don’t bother. It is much easier to set a password that is easy to remember, but hackers rely on this to break into insecure sites.

Try to at least make it hard to guess by making it eight characters or more, and throw in numbers and symbols and both upper and lower case letters. Like the username, it’s also important not to use any personal information in your password like your name, email, birthday, phone number, etc. so that if any of that information was known, you still have good password security.

Suggested Read: Top 6 Password Manager Tools – 2018 Update

Worst of all, stay far away from the most basic passwords that I guarantee you are the first ones that hackers try: password, 12345678, abcd1234, qwerty, letmein, itsasecret, iloveyou, etc.

Believe it or not, a password like “onetwokafourfourtwokaone” or “bomdiggydiggybombom” is a LOT more secure than something
like “Passw0r3d&“.

Generate Random Password with Openssl – 

OpenSSL is a software library for applications that secure communications over computer networks against eavesdropping or need to identify the party at the other end. It is widely used in Internet web servers, serving a majority of all web sites.

With openssl you can even generate base64 encoded random password by typing the following command in your terminal:

Command: openssl rand -base64 14

Which will generate a random password of 14 digits.

Generate Random Password with urandom – 

In Unix-like operating systems, /dev/random, /dev/urandom and /dev/arandom are special files that serve as pseudorandom number generators.

They allow access to environmental noise collected from device drivers and other sources.

To generate a random password with urandom, type the following command in your terminal:

Command: < /dev/urandom tr -dc A-Za-z0-9 | head -c14; echo

Where tr command will delete all unwanted characters from the output and display only first 14 characters which acts as a random password.

Generate Random Password with pwgen – 

PWGen is a professional password generator capable of generating large amounts of crypto graphically secure passwords, classical passwords, pronounceable passwords, pattern-based passwords, and passphrases consisting of words from word lists.

It uses a “random pool” technique based on strong cryptography to generate random data from in deterministic user inputs (keystrokes, mouse handling) and volatile system parameters.

To do this, type

Command: pwgen 14 1

Where 1 stands for not displaying the output in columns.

Generate Random Password with gpg – 

GPG is a hybrid-encryption software program because it uses a combination of conventional symmetric-key cryptography for speed, and public-key cryptography for ease of secure key exchange, typically by using the recipient’s public key to encrypt a session key which is only used once.

This mode of operation is part of the OpenPGP standard and has been part of PGP from its first version.

To generate a random password with gpg, the command is:

Command: gpg –gen-random –armor 1 14

You may also like:

Sarcastic Writer

Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.

Related Posts