Board index Linux General Stuffs

Moderator: chandranjoy

Random Password Generator - Linux

Postby chandranjoy » Sat Feb 04, 2012 3:51 pm

How to generate Random/Secured passwords in Linux?

Copy and paste the following code at the end of /root/.bashrc file
Code: Select all
genpasswd() {
        local l=$1
        [ "$l" == "" ] && l=20
        tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}


Then type,
Code: Select all
genpasswd 12

Output:
zzCKSosOXTEK

You will get the 12 character password in mixed style.

Cool :)
chandranjoy
Site Admin
 
Posts: 283
Joined: Fri Oct 23, 2009 11:19 pm

Return to General Stuffs

Who is online

Users browsing this forum: Google [Bot] and 1 guest


cron