How to Generate/Encrypt/Decrypt Random Passwords in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

17 Responses

  1. Ravindra says:

    You are Boss…Linux ka Maha-Guru

  2. Mahendra says:

    Great site of linux I have ever seen

  3. Noob says:

    Interesting! Great article, thank you!

    Tecmint is a great web site. Always helpful.

  4. aaa says:

    $ echo $RANDOM | md5sum | cut -c 1-8

    • Avishek Kumar says:

      Thanks aaa. We will include your tips in our “Linux Tips and tricks article” (& will elaborate it there).
      Keep connected and keep commenting.

      • Stef says:

        Be aware that the value returned by $RANDOM is between 0 and 32767 so this method is not very secure. You should add a seed. Also, the output contains only 8 hexadecimal numbers and so should be easy to crack by brute force.

        echo FooBar$RANDOM | md5sum | base64 | cut -c 1-8

        Another alternative is to generate random bytes using /dev/urandom (or even better using /dev/random but that one can be very slow) and to convert them to characters using base64

        cat /dev/urandom | base64 | head -n 1 | cut -c 1-8

        • Stef says:

          As a second though, applying base64 to the output of md5sum, so an hexadecimal number, is even worse because that seriously limits the possibilities.

          Here a small bash command that shows the probability of finding a character at each rank 1-8. This is of course cyclic since base64 encodes 3 input bytes in 4 characters.

          # for ((j=1;j<=8;j++)) ; do echo === $j ; for ((i=0;i<1000;i++)) ; do echo $RANDOM | md5sum | base64 | cut -c $j ; done | sort | uniq -c ; done

  5. Plazma says:

    Which app do you use for animated command line?

    • Avishek Kumar says:

      Dear Plazma,
      I am sorry, but it is a project developed by us and we have not named it yet. At this point we have not even concluded to publish the software under any particular Licence.

      Keep connected!

  6. Carl says:

    Hi Avishek,

    Could you tell me how you make that animated gif captures, please?. It is very nice.

    Thanks

    • Avishek Kumar says:

      Dear Carl,
      I am sorry, but it is a project developed by us and we have not named it yet. At this point we have not even concluded to publish the software under any particular Licence.

      Keep connected!

  7. Adrián Rodriguez says:

    Hi Avishek, I try your examples but I’m stuck with the example of “mkpasswd” I tried to install using apt-get but doesn’t found the package I searched with apt-cache search and found something, but results that is other program “mkpasswd.pl” which doesn’t have the ability to use the “Salt”, Could you please tell me how to install this tool.

    Thanks in advance

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?