This is a common question a lot of people are afraid to ask.
The easiest way I have found is through a utility called apg or automatic password generator. It’s available on most Debian and Ubuntu based operating systems by typing apt-get install apg -y and it will install for you.
If you have CentOS, you need to enable RPM Forge’s repositories.
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
You install your appropriate package with rpm -i rpmforge-release-*.rpm
Once installed, yum install apg should install apg for you as apg is maintained by RPM Forge.
When you want to create a random password, you type in apg into the Terminal screen of your computer or your SSH client into your server.
# apg Please enter some random data (only first 8 are significant) (eg. your old password):> Cabnobaj9 (Cab-nob-aj-NINE) Omodand2 (Om-od-and-TWO) erlErrorl4 (erl-Err-orl-FOUR) Tedd8Knil (Tedd-EIGHT-Knil) nebViObobs1 (neb-Vi-Ob-obs-ONE) WoossOnyax7 (Wooss-On-yax-SEVEN)
I just type in random keyboard gibberish when they prompt me for random data.
For maximum password security, I would normally combine two passwords together such as Cabnobaj9Omodand2, Omodand2erlErrorl4, or nebViObobs1WoossOnyax7.