Most Linux servers still use password-based authentication for local and remote login. Since server hacks are on the raise, it's important to have in place schemes to secure your server.
Now I strongly recommend you use passwordless key-based authentication especially when SSHing into remote boxes, but if you choose to go with passwords either for logging in or setting database passwords, here are some tools you can use to create strong passwords.
By far pwgen tool is my favorite commandline tool for generating secure passwords. The tool is available on the Ubuntu repository so you can use apt-get to install it like;
sudo apt-get update
sudo apt-get install pwgen
Now you generate random passwords by simply running pwgen.
[email protected]> pwgen zo2aa7Ic aijooL4V osh9Aer9 thie9Ov9 ahPaeVa2 ueY2phoo Shiequ2a Ha3aew5f
You can even to choose stronger ones by specifying the number of characters and that is should contain special characters with the -y option like so;
The other options include using Linux terminal inbuilt commands;
date | md5sum and you get something like
and also run
date +%s | sha256sum | base64 | head -c 32 ; echo which would output something like
The last two methods are great when writing a shell scripts and you have a function that generates random secure passwords.
Subscribe to David Okwii dev blog
Get the latest posts delivered right to your inbox