Create your own .pem for ssh login using certificate

Some of my colleagues asking me this, how can i login to my server using certificate like i login to aws (amazon web services).

1. Setup your server ssh-keygen -t rsa -b 2048 cat ~/.ssh/ >> ~/.ssh/authorized_keys

2. Copy your secrets to your a file let’s give it a name ‘awan.access.pem’, you can give it any name you want scp . cp id_rsa awan.access.pem chmod 0600 awan.access.pem

or just cat the id_rsa file, copy the content to a file and rename the file

3. Let’s access our box using .pem certificate file from any box, please don’t share the key to unauthorized personel ssh -i awan.access.pem

awan : change is to your username : this is also an example, change this to your server ip, linux box, or your domain name

after step number 2 your can create image or snapshot from the virtual machine or container so next time you login you don’t have to regenerate the key anymore.

Fixing Ubuntu 14.04 error when compiling barnyard error: possibly undefined macro: AC_PROG_LIBTOOL

this is the error

addhe@google:~/barnyard$ autoreconf -fvi
autoreconf: Entering directory `.'
autoreconf: not using Gettext
autoreconf: running: aclocal --force -I m4
aclocal: warning: autoconf input should be named '', not ''
autoreconf: tracing
autoreconf: not using Libtool
autoreconf: running: /usr/bin/autoconf --force error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

how to fix this ? just simply using this command

#sudo apt-get install libtool

if you’re install IDC snort like me just make sure this package already installed, it this below package already installed then you will not face error above.

#apt-get -y install libwww-perl libnet1 libnet1-dev libpcre3 libpcre3-dev autoconf libcrypt-ssleay-perl libtool libssl-dev build-essential automake gcc make flex bison

Terminate all query on postgresql with one command line

Please don’t use this if you do not know what exactly gonna happen.

format :
psql -U{USERNAME} -h{HOSTNAME} {DATABASE_NAME} -c "select pid from pg_stat_activity" -t | xargs -n1 -I {} psql -c "SELECT pg_terminate_backend({})"

change the variable with that suits to your configuration, i put sampel below

sample :
psql -Ugoogleadmin -hgoogle_com google_production_db -c "select pid from pg_stat_activity" -t | xargs -n1 -I {} psql -c "SELECT pg_terminate_backend({})"

Using sdiff properly

as many people using sdiff in the wrong way, most of people just want the diffrence. if you have only 100 or 200 line it’s fine. what happen if you have 100000 lines compare to 100000 lines.


#sdiff -bBWs $FILE_TES1 $FILE_TES2

this will output only the diffrence

simulate cpu load for your server

This scripts will detect how much cpu processor on your server and simulate “fake” load, don’t do this on production server as this will blow up your entire system. ‘cpu’ is just a variable

cpu_total=`cat /proc/cpuinfo | grep processor | wc -l`
for cpu in $(seq 1 $cpu_total)
( while true; do true; done ) &

how to filter kibana for last 24 hours

#this is what you will face when you using kibana, you want to filter kibana for only show latest data 24hour in your panel.

once you installed kibana and make’s your data live here’s the step to make your panel 24 hours from now

1. open your kibana url something like

2. put a sample filter in your kibana dashboard

3. save your dasboard

4. export your dashboard as json file, it will download file json into your PC

5. edit your json file (the one that you download already), there is should be something like this if you already have sample filter in step 2

"filter": {
"idQueue": [
"list": {
"0": {
"type": "time",
"from": "now-24h",
"to": "now",
"field": "@timestamp",
"mandate": "must",
"active": true,
"alias": "",
"id": 0
"ids": [

6. make sure your filter have this and save it as “something dashboard”

7. click load and pick your “something dashboard”

your filter panel should show last 24 hour from now in real time mode. congratulation

error when running glances

if your found error like this after install glances monitoring tools, don’t be panic i have been thru this before

awan@awan-local-server:~$ glances
Traceback (most recent call last):
File “/usr/local/bin/glances”, line 5, in
from pkg_resources import load_entry_point
File “/usr/lib/python2.7/dist-packages/”, line 2707, in
File “/usr/lib/python2.7/dist-packages/”, line 686, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/lib/python2.7/dist-packages/”, line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: psutil>=0.5.1

the solution just execute this command

:~$ sudo pip install psutil

if you don’t have pip, install pip using command

sudo apt-get install pyhton-pip python-dev

glances is quite advance and detail like atop, but it’s more easy to understanding. i prefer glances rather than htop.