Monday, 1 May 2017

Remote support service for Open Source operating system and software

If you are having issues with Linux and Open Source software, and require assistance or guidance, I can help you with minimal fee. I'm also providing system consultation if you are planning to deploy Open Source solution. Do contact me at email

Some of the software that I'm capable of supporting or consulting:
  1. Linux (Debian, Ubuntu, CentOS, RHEL)
  2. Webserver (Apache httpd, nginx)
  3. SSL certificate purchasing and deployment
  4. BackupPC desktop backup
  5. Puppet and Ansible
  6. Squid proxy
  7. pfSense
  8. Mail server solution (postfix, dovecot, spamassassin)
  9. Shell scripting

Sunday, 31 July 2016

Generating random password with Bash

If you want to create secure and random password, you can install several software that can help you, such as:

  1. makepasswd
  2. passwordmaker-cli
  3. apg
  4. pwgen
But, what if you don't want to install all this software, and using your Bash shell instead.

You can actually do that.

The command that I commonly use to generate secure and random password is below:

cat /dev/urandom | base64 | head -n1|tr -cd '[:alnum:]'|cut -c-16

This command will generate password with 16 character. If you want it to be longer or shorter, change the last number. Beware that password less than 8 characters can be bruteforced fairly easily with modern hardware.

There are other method that use date +%s as the input source, but I would not recommend it because the number is too predictable. If a hacker knows that you generate password using the date method, he can quickly build a dictionary of password with different length and start bruteforcing your site with the dictionary.

Please test the command above, and leave comment if you have any question.

Tuesday, 20 October 2015

Using Pageant with Cygwin SSH, error with ssh-dss key

Recently, I tried to configure Cygwin SSH to use Pageant. No big issue, just launch the Cygwin installer, and look for package named ssh-pageant

After installation, execute Pageant on your Windows computer, and load the required SSH key

Then in your Cygwin terminal, execute the following command:

$ `ssh-pageant`

Make sure the backtick is included in the command

Then try to SSH to your server using the command

$ ssh -A

If you are getting a password prompt, you are facing the same problem that I got.

The main issue here is the version of SSH included in latest Cygwin is version 7 or higher. Version 7 have deprecated the support for ssh-dss, which is used by Puttygen

To check if you are indeed being restricted to use ssh-dss key,  SSH again to your server, but this time add "v" to the option so that you can see what happening during the connection:

$ ssh -Av

You will see this line:

debug1: Skipping ssh-dss key imported-openssh-key for not in PubkeyAcceptedKeyTypes

To overcome this issue, just create a file call config in ~/.ssh

$ touch ~/.ssh/config

Edit the content of the file to include this line:

Host *
    PubkeyAcceptedKeyTypes +ssh-dss

Try to SSH to your server again, you should now be able to login without any prompt asking for password, as the key required is being supplied by Pageant.

Hope this solve your problem.

Reference for this issue was obtained from:

Wednesday, 1 July 2015

HP ServiceGuard command list

Recently, I'm doing more work on HP-UX and the HP ServiceGuard, a high-availability cluster software produced by HP that runs on HP-UX and Linux.

Here are the command that I frequently use. The list is not final, and I will keep updating it.

Halt cluster

Shutdown package
cmhaltpkg [package name]

Get the cluster config
cmquerycl -q [quorum server] -C /home/user/cmclconfig.ascii -n [node1] -n [node2]

Get the quorum server
cd /etc/cmcluster grep QS_HOST *

Apply configuration
cmapplyconf -v -C /etc/cmcluster/cmclconfig.ascii

Start cluster

Node join cluster

Check cluster package
cmviewcl - view information about a high availability cluster

Bring up cluster
cmrunnode [node1] [node2] [node3] [node4]


    Thursday, 31 October 2013

    Howto: Calculate exponent or power in Bash

    I have been looking on how to calculate exponent or power in Bash, but most website or blog will show the calculation by using bc (a command line calculator)

    I prefer not to use bc in my script, as it is a dependency to another application.

    Luckily, I found this blog after searching the Internet for few hours.

    In essence, if you want to calculate exponent or power in Bash, just use this notation:


    Gigabyte is 1024^3. In bash notation:

    gigabytes=$((bytes / (1024**3)))

    echo $((10737418240/(1024**3)))

    Bear in mind that bash calculation only return round number.

    Happy scripting :)

    Thursday, 22 August 2013

    Howto: Extract all email address from Google Contacts

    Let's say you want to extract all email address from your contacts in Google Contacts, and export it somewhere else. Yes you can just export the CSV file, and then upload. The other service will do the import and cleanup for you. But, if you just want to share the email address, why give them other info that they are not suppose to have?

    OK. Here are the steps to only extract email address using command line. I'm using Cygwin, but it should be similar if you are using Linux or other Unix-based operating system.

    Follow this steps:

    1. Select Contacts in Gmail

    2. Your contacts will be shown. Click More > Export

    3. Select All Contacts and Google CSV format, then click Export

    4. Save the file somewhere. I save it in C:\google.csv . If you are using Cygwin, the file is accessible using the path \cygdrive\c\google.csv

    5. Now come the interesting part, to extract the email address. The data is separated by comma, and we don't really know which column holds the email address. So we must iterate all column, and extract anything that resembles an email address. Here is the command:

    $ grep @ google.csv | awk -F, '{for(i=1;i<=NF;i++) if ($i ~ /@.*\./) {printf "%s\n", $i};}' | awk -F" ::: " '{for (i=1;i<=NF;i++) {print $i};}' |sort |uniq

    6. Let's break the command apart

    7. grep @ google.csv

    This command will get line that contain "@" character. The result is lines that contain "@", with multiple column, separated by comma ","

    8. awk -F, '{for(i=1;i<=NF;i++) if ($i ~ /@.*\./) {printf "%s\n", $i};}'

    This command let awk know that the field separator is comma (-F,). It will loop through all the field (for(i=1;i<=NF;i++)). If that field match an email pattern ($i ~ /@.*\./), it will print that field.

    9. awk -F" ::: " '{for (i=1;i<=NF;i++) {print $i};}'

    Some of the field will have multiple email address separated by " ::: ", because it groups the email address together. This command will split the field using " ::: " separator (-F" ::: ") then loop through each field, and print each of them

    10. sort

    This command will sort the output

    11. uniq

    This command will remove any duplicates.

    12. In the end you will get a list of emails. But, you must understand that the output might not be 100% clean. Some of your contact might put their email with their name, or the note area of your contact might contain additional information that resembles email. You need to clean up your output, but the effort will be small.

    Thursday, 4 April 2013

    How To: Boot from USB drive even if your BIOS won't let you

    This post is a continuation from my post about How To: Easy CentOS 6.3 installation using USB thumb drive

    After I finished setting up the USB thumb drive, one of the machine that I'm going to install did not allow me to boot from USB, because the BIOS did not support that capability.

    As I'm not going to burn the CentOS 6.3 Installer ISO into a CD-RW, just for this machine, I searched the Internet to find solution to this problem. And I found it.

    The solution is called plopKexec. This software, when you boot from the CD drive, will search if there are any USB drive attached to the system, and will try to load the Linux bootloader from that drive.

    How to use it:

    1. Visit the URL
    2. Click on Download
    3. Dowload the plopkexec.iso file
    4. Burn the ISO file into CD-R or CD-RW
     On the computer that you want to install using USB drive
    1. Plug in your USB drive into any USB port
    2. Put the plopkexec CD into the CD drive
    3. Power on your computer
    4. The CD will boot, an the menu from your USB thumb drive will shown
    5. Select "Install or upgrade an existing system" and continue installing CentOS 6.3 as normal
    Here's the screenshot of plopkexec loading the GRUB menu from my USB thumb drive

    That's it.

    Simple way to solve your USB booting issue :)

    Please leave comment if this solution have helped you.