Categories
Red Hat Enterprise Linux / CentOS

Generate Random Password – Red Hat/CentOS

There are instances wherein you want to generate random passwords for setting up MySQL/User credentials or use for kickstarts. There is a very simple random password generator in-built into Red Hat/CentOS. Just run the below command.

# cat /dev/urandom | tr -dc ‘a-zA-Z0-9’ | fold -w 24 | head -n24 | head -n1

Output:

[[email protected] farooq.ahmed]# cat /dev/urandom | tr -dc ‘a-zA-Z0-9’ | fold -w 24 | head -n24 | head -n1
gBE5LWroORn6mu3rCb3IguUx 

Leave a Reply

Your email address will not be published.