Resize Multiple Images


I am sure you would have come to a situation when you would have to resize multiple images say you copied 200 images from your Digital Camera and now need to upload them and need to resize them all, now doing this using GIMP would take ages here is a easy way.

Step 1) Install ImageMagick

sudo apt-get install imagemagick

Step 2) Change to the Directory where all Images are Present

Step 3)

a) If you need to reduce images to a specific Percentage

mogrify -resize 20% -format jpg *

b) If you need to reduce to Specific Width & Height

mogrify -resize 800x600 -format jpg *

c) If you need to reduce to Specific Width

mogrify -resize 1024x -format jpg *

Further Reading Click Here !!!

Restore GRUB 2

In most of the systems GRUB is now upgraded to 2.0 and with this update the old restore process have also changed now there is no grub command :) available.

If you have lost the Bootloader after a routine reinstall or due to any other reason try the following to restore

Boot Using a Live CD and try the following as root

grub-setup -d /media/XXXXX/boot/grub -m /media/YYYYY/boot/grub/ /dev/sda

Where XXXXX represents the root partition and YYYYY represents the partition holding the /boot in case you dont have a seperate partition for /boot then XXXX and YYYY would be be the same. /dev/sda may change depending on the system you are using.

Please note this would erase the current bootloader and install a new one for you if you are unsure of what you are doing do not try this

Once done reboot and you will get the GRUB Menu in case you have lost your other OS from the Menu run a


for more information visit the Documention here.



Where .deb files are stored in Ubuntu ?

We always hear people saying ubuntu works well only when you have a strong internet connection as the Install CD doesn't contain all the packages required agreed now a CD cannot contain all the packages you require so you need to download the packages but there is a clear misunderstanding among new users that they always need to download these packages, Its essential to download them once but if you are reinstalling ubuntu on new machine you need not download these packages all over again if you have installed required packages on one of the machine you can use the content of below listed directory for installation


this directory contains the debian packages download by the apt-get :)

so have fun reuse the content for each install and save time and bandwidth

Hosting a Website from Local Machine

I am sure you would have thought atleast once of hosting your website from your machine itself, if not the website atleast a sandbox version of it as it would be comparatively easy for you to maintain it so i discuss the steps you need to follow to achieve this, first lets go through the requirements, in this post i am talking about small sized sites a minor modified version of this post is applicable for large sites as well.


1) A really broad Internet Connection.
2) A Static IP
3) A High End Machine (if the site you are hosting is pretty static a lower end machine is sufficient to be more clear a dynamic personal blog kind of site will also never need more than 1000 Mb of RAM unless you are the Top blogger of the country)
4) Server Software (Apache preferred)
5) A Database Server (if needed, mysql/postgresql recommended)
6) Scripting Support (might be PHP. perl, python as per the requirements)

In simple words your local LAMP machine can work as the server for your website :)

I have the machine ready with a good internet connection and a static IP Now what

Hey you are almost done just a few entries here and there and you host the website from your home

Now you will need to resolve your domain to your IP address, now whats it and how will i do this

Its quite simple you need to add an entry in DNS so that it can resolve this, request your registrar to do this for you if you are unable to do this, generally you would be able to do this at no additional costs, in simple terms if you have registered a domain say and your static IP is x.x.x.x then should resolve to x.x.x.x thats it.

Once the above step is done and are planning to host only one website then your setup is ready :) if you need to host more than one domains on this single machine just add virtual hosts in your server configuration for each of the domains and make all domains pointing to same IP.

What else you will have to do ?

Keep this machine up 24x7 after all you will not like your site to be down


Also dedicate the machine as server dont try playing games on it, its a server now and putting extra load to it will slow down your site performance

I would warn hosting a server is not that easy as it looks like security issues can pop up now and then and you should be technically sound to handle this so its recommended spending some amount and  take a hosting plan from someone in the business after all he is there for providing you services.

Key Based Authorization with SSH

Using remote shells is all time favourite but remembering those many passwords is a pain so here are the steps to login using SSH without putting a password :)


1. Create a public ssh key, if you haven’t one already. Look at ~/.ssh. If you see a file named then you obviously already have a public key. If not, simply create one.

ssh-keygen -t dsa should do the trick. Please note that there are other types of keys, e.g. RSA instead of DSA.

2. Make sure your .ssh dir is not publically writable

    # chmod 700 ~/.ssh

3. Get your public ssh key on the server you want to login automatically.
    #scp ~/.ssh/

4. Append the contents of your public key to the ~/.ssh/authorized_keys and remove it.

Important: This must be done on the server you just copied your public key to. Otherwise you wouldn’t have had to copy it on your server. Simply issue something like


    # cat >> .ssh/authorized_keys while at your home directory.


5. Instead of steps 3 and 4, you can issue something like this:
    # cat ~/.ssh/ | ssh -l remoteuser 'cat >> ~/.ssh/authorized_keys'

   6. Remove your public key from the home directory on the server.

   7. And you are in

    # ssh -l remoteuser
    # ssh


 without getting asked for a password.

Configuring Apache with SSL

Apache is the most common web server used now a days, you would have already configured apache many times by now but what about configuring it with SSL i.e. using apache to service on the https protocol, i assume you have already configured the basic apache server and have also enabled the SSL module, if not refer to my previous post on Configuring Apache Web server.

The following post is an extremely simplified step by step guide to configure SSL in apache using Self Signed Certificates you can also use a real certificate issued by a CA if you have it


1) Apache with SSL module enabled
2) openssl installed

Step 1) Generate a Private Key

We will use the openssl toolkit for generating a RSA Private Key and Certificate Signing Request, as the first step generate the key the command below will create a 1024bit key using 3des$ openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
unable to write 'random state'
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:

Step 2) Generate a CSR (Certificate Signing Request)

Once the key is generated you will need to make a CSR or Certificate Signing Request, using the following command you can generate a CSR in this process you would be asked to enter various parameters as shown below$ openssl req -new -key server.key -out server.csr

Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [AU]:IN
State or Province Name (full name) [Some-State]:UK
Locality Name (eg, city) []:Kashipur
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Kashipur Networks
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []
Email Address []:abhishek at kashipur dot net

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Step 3) Remove Pass phrase from Key

This is completely an optional step if you skip this you will have to run to the server as and when the server restarts to enter the pass phase :) , use the following commands to get rid of this problem$ cp server.key$ openssl rsa -in -out server.key

Enter pass phrase for
writing RSA key

Step 4) Generating a Self-Signed Certificate

Once you have your Key and CSR ready its time to generate the Certificate use the following command to generate a certificate$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Signature ok
subject=/C=IN/ST=UK/L=Kashipur/O=Kashipur Networks/ at kashipur dot net
Getting Private key

Step 5) Copy Certificate and Key to Apache Folder

After following the steps above you would have the following files generated$ ls -l

-rw-r--r-- 1 abhishek abhishek 952 2009-06-12 14:30 server.crt
-rw-r--r-- 1 abhishek abhishek 704 2009-06-12 14:27 server.csr
-rw-r--r-- 1 abhishek abhishek 887 2009-06-12 14:29 server.key
-rw-r--r-- 1 abhishek abhishek 963 2009-06-12 14:28

Copy the crt and key file to a preferable location inside the apache configuration folder generally /etc/apache2/cert using the following command$ cp server.crt server.key /etc/apache2/cert

Step 6) Configure Apache with SSL

Once you have your Certificate and Key copied, modify your httpd.conf to reflect the following

SSLEngine on
SSLCertificateFile /etc/apache2/cert/server.crt
SSLCertificateKeyFile /etc/apache2/cert/server.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

Ensure apache is listening to Port 443 if not add the Listen Directive. After making these changes preferable verify the configuration file using the following command$ apache2ctl configtest
Syntax OK

Once you see Syntax OK you are ready to use https.

Step 7) Restart Apache and test

To apply the configuration changed you need to restart apache which can be done using the following command service apache2 restart

or service httpd restart (in many cases)

Once you restart test it by appending https:// to the URL

Happy HTTPS :)

Configuring BSNL EVDO Modem in Debian GNU/Linux

EVDO DeviceI recently shifted to Debian GNU/Linux (Lenny), and the first task included configuring my Internet Connection, i use BSNL EVDO Modem to connect to the internet which is not recognized my default in Debian so following is the process by which i configured my BSNL EVDO in Debian

Step 1) Checked for Modem, Vendor and Product ID

$ cat /proc/bus/usb/devices

You will find many entires in this just check for your modem entry in my case i found

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=fffe Rev= 0.00
S:  Manufacturer=ZTE, Incorporated
S:  Product=ZTE CDMA Tech

by this i know the following information


Step 2) Detect modem (as root user)

# modprobe usbserial vendor=0x1952 product=0xfffe

Note : appending "0x" before Vendor and ProdID is a must

Step 3) Replug The Modem

Check if its detected using dmesg

# dmesg

[   14.280399] usbcore: registered new interface driver usbserial
[   14.280399] usbserial: USB Serial support registered for generic
[   14.280399] usbserial_generic 1-1:1.0: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB0
[   14.280399] usbserial_generic 1-1:1.1: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB1
[   14.280399] usbserial_generic 1-1:1.2: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB2
[   14.280399] usbserial_generic 1-1:1.3: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB3
[   14.280399] usbcore: registered new interface driver usbserial_generic
[   14.280399] usbserial: USB Serial Driver core

from this you come to know that your modem Device is ttyUSB0

Step 4) Install wvdial

# apt-get install wvdial

Step 5) Configure wvdial

edit the wvidal configuration file (/etc/wvdial.conf) below is my wvdial.conf this should work for you aswell

# gedit /etc/

[Dialer Defaults]
Modem = /dev/ttyUSB0
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = on
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = cdma
Password = cdma
Baud = 9600

Step 6) Connect :)

# wvdial

hey you are now connected.....

Step 7) Adding the Modem Detection @ startup

edit /etc/modules and add the following

usbserial vendor=0x1952 product=0xfffe

# gedit /etc/modules (add the above line)

Notes : wvdial runs as a super user to enable this for normal user you need to edit user permissions.

Tuz the new mascot for Linux

Tux the Linux mascot will take a break for a while with the release of Kernel 2.6.29 Tuz would be replacing Tux.

Tuz mascot for 2.6.29

Tuz is a Tasmanian Devil, which is a species in danger of becoming extinct. The Tasmanian Devil is native to Australia and during this year's Linux.Conf.Au conference it was decided that Tuz will stand in for Tux for one kernel release in order to raise awareness for this creature. Tux will return with the release of the Linux 2.6.30 kernel :).


Whats in your MBR ??

Master Boot Record or the MBR max to 512 Kb but very essential have you ever looked at what your MBR contains most probably NO!!, so try out the following 2 commands as root and check your MBR Contents

# dd if=/dev/hda of=mbr.bin bs=512 count=1
# od -xa mbr.bin

This will display your MBR change hda to sda if u have an sda type disk, following is my MBR you might not understand anything from this but a careful look is required to know what is it :)

0000000 48eb d090 bc66 7c00 0000 c08e d88e e689
k H dle P f < nul | nul nul so @ so X ht f
0000020 bf66 0600 0000 b966 0100 0000 a5f3 23ea
f ? nul ack nul nul f 9 nul soh nul nul s % j #
0000040 0006 8000 80fa 057c fa80 7e87 b202 8880
ack nul nul nul z nul | enq nul z bel ~ stx 2 nul bs
0000060 4916 6607 bebf 0007 3100 66f6 04b9 0203
syn I bel f ? > bel nul nul 1 v f 9 eot etx stx
0000100 00ff 2000 0001 0000 0200 90fa f690 80c2
del nul nul sp soh nul nul nul nul stx z dle dle v B nul
0000120 0275 80b2 59ea 007c 3100 8ec0 8ed8 bcd0
u stx 2 nul j Y | nul nul 1 @ so X so P <
0000140 2000 a0fb 7c40 ff3c 0274 c288 be52 7d7f
nul sp { sp @ | < del t stx bs B R > del }
0000160 34e8 f601 80c2 5474 41b4 aabb cd55 5a13
h 4 soh v B nul t T 4 A ; * U M dc3 Z
0000200 7252 8149 55fb 75aa a043 7c41 c084 0575
R r I soh { U * u C sp A | eot @ u enq
0000220 e183 7401 6637 4c8b be10 7c05 44c6 01ff
etx a soh t 7 f vt L dle > enq | F D del soh
0000240 8b66 441e c77c 1004 c700 0244 0001 8966
f vt rs D | G eot dle nul G D stx soh nul f ht
0000260 085c 44c7 0006 6670 c031 4489 6604 4489
\ bs G D ack nul p f 1 @ ht D eot f ht D
0000300 b40c cd42 7213 bb05 7000 7deb 08b4 13cd
ff 4 B M dc3 r enq ; nul p k } 4 bs M dc3
0000320 0a73 c2f6 0f80 ea84 e900 008d 05be c67c
s nl v B nul si eot j nul i cr nul > enq | F
0000340 ff44 6600 c031 f088 6640 4489 3104 88d2
D del nul f 1 @ bs p @ f ht D eot 1 R bs
0000360 c1ca 02e2 e888 f488 8940 0844 c031 d088
J A b stx bs h bs t @ ht D bs 1 @ bs P
0000400 e8c0 6602 0489 a166 7c44 3166 66d2 34f7
@ h stx f ht eot f ! D | f 1 R f w 4
0000420 5488 660a d231 f766 0474 5488 890b 0c44
bs T nl f 1 R f w t eot bs T vt ht D ff
0000440 443b 7d08 8a3c 0d54 e2c0 8a06 0a4c c1fe
; D bs } < nl T cr @ b ack nl L nl ~ A
0000460 d108 6c8a 5a0c 748a bb0b 7000 c38e db31
bs Q nl l ff Z nl t vt ; nul p so C 1 [
0000500 01b8 cd02 7213 8c2a 8ec3 4806 607c b91e
8 soh stx M dc3 r * ff C so ack H | ` rs 9
0000520 0100 db8e f631 ff31 f3fc 1fa5 ff61 4226
nul soh so [ 1 v 1 del | s % us a del & B
0000540 be7c 7d85 40e8 eb00 be0e 7d8a 38e8 eb00
| > enq } h @ nul k so > nl } h 8 nul k
0000560 be06 7d94 30e8 be00 7d99 2ae8 eb00 47fe
ack > dc4 } h 0 nul > em } h * nul k ~ G
0000600 5552 2042 4700 6f65 006d 6148 6472 4420
R U B sp nul G e o m nul H a r d sp D
0000620 7369 006b 6552 6461 2000 7245 6f72 0072
i s k nul R e a d nul sp E r r o r nul
0000640 01bb b400 cd0e ac10 003c f475 00c3 0000
; soh nul 4 so M dle , < nul u t C nul nul nul
0000660 0000 0000 0000 0000 c6d7 0002 0000 0180
nul nul nul nul nul nul nul nul W F stx nul nul nul nul soh
0000700 0001 fe83 ffff 003f 0000 36a8 01e0 fe00
soh nul etx ~ del del ? nul nul nul ( 6 ` soh nul ~
0000720 ffff fe83 ffff 36e7 01e0 124d 00a0 fe00
del del etx ~ del del g 6 ` soh M dc2 sp nul nul ~
0000740 ffff fe82 ffff 4934 0280 3986 0040 fe00
del del stx ~ del del 4 I nul stx ack 9 @ nul nul ~
0000760 ffff fe05 ffff 82ba 02c0 6207 0690 aa55
del del enq ~ del del : stx @ stx bel b dle ack U *