How to Generate Random Passwords in Linux

1.Using md5sum command.

[root@localhost ~]# test | md5sum
d41d8cd98f00b204e9800998ecf8427e  -
[root@localhost ~]#

here we can pass any string to md5sum command  example

[root@localhost ~]# date | md5sum
c9c1de4335bb36a2b3d369df788acfad  -
[root@localhost ~]#

2.Using openssl command

[root@localhost ~]# openssl rand -base64 16
2E/dwnWZiDY6utzwwpwzlw==
[root@localhost ~]#

here 16 is password length you can give length of your choice.

3.Using /dev/urandom

[root@localhost ~]# tr -dc A-Za-z0-9 < /dev/urandom | head -c 15 | xargs
TIgXMy8TXnX6uAN
[root@localhost ~]#

here -c 15 is length of password string you can give length of your choice.
4.Using makepasswd command  .

makepasswd  --char 50

–char 50 specifies the lenght of the password string.

5.Using pwgen command .

pwgen 10 1

here 10 is length of the password and 1 is number of passwords to be generated.

use  -s option to Generate completely random passwords

Advertisements
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s