Create Your Own Password Genetator In Bashrc!

Started by Skhilled, September 15, 2019, 02:26:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


No more going to other sites to generate random passwords! Just add the following code below to bashrc. In any SSH terminal use the following code to find out where bashrc resides:

whereis bashrc

Open it in your favorite editor and add the following code to the bottom of the file:

function pass()
    if [ "$#" -ne 1 ]; then

    pass=`</dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${count}`
    echo $pass

Reboot your session then type "pass" which will give you a random 15 character password. You can change the length of the password by specifying a parameter such as "pass 20" which will generate a random 20 character password.



You must type in "whereis bashrc" in SSH and it will tell you exactly where the file is on your server. You will then have two options...

1.  If your control panel (WHM/cpanel, etc.) allows you to access and edit files you can locate it and edit it there. If you can't, there are tools/addons to allow you to do this.

2.  Use a good ssh/putty tool like MobaXterm. It also has options to view your files on the server as well as choosing a default editor to edit and save them. ;)