Docskillz

Computer Love => Servers => Topic started by: Skhilled on September 15, 2019, 02:26:34 PM

Title: Create Your Own Password Genetator In Bashrc!
Post by: Skhilled on September 15, 2019, 02:26:34 PM
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
        count=15
    else
        count=$1
    fi

    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.
Title: Re: Create Your Own Password Genetator In Bashrc!
Post by: Ronald on June 19, 2020, 11:47:15 AM
How is this done? Where is bashrc
Title: Re: Create Your Own Password Genetator In Bashrc!
Post by: Skhilled on June 19, 2020, 11:56:20 AM
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 (https://mobaxterm.mobatek.net/). It also has options to view your files on the server as well as choosing a default editor to edit and save them. ;)