Author: rahul

  • trash-cli

    There is one feature I often missed in linux console – deleting to Trash. I often do a ‘rm -rf’ and then suddenly realize that I have accidentally deleted something which I shouldn’t have. From now on, I needn’t worry because I have started using trash-cli, a command line interface to the freedesktop.org trashcan. This small utility provides commands to delete and restore files from the console. The version shipped with Debian is really old and has a serious bug which could destroy data. Updated version now available in Debian repos and this should be preferred to the next mentioned method. Run the below commands as root to install it:

    # apt-get install python-setuptools
    # easy_install --prefix=/usr/local trash-cli
    

    Instructions for installing on other distributions are at http://code.google.com/p/trash-cli/wiki/Download. Usage instructions can be found in the home page of trash-cli itself.

    This is yet another one of those linux utilities which is very simple but is extremely useful. I love Linux !!!

  • Washing Machine

    I generally avoid hiring a maid and like to automate the daily chores to the maximum possible extent. The biggest investment in this direction was the washing machine. This was purchased with the marriage gift money given by my Aunt Suchitra (Mom’s elder sister). After reading several reviews and comparing the different models of washing machines, we finally decided to go for Whirlpool ABM551 5.5 Kg front load fully automatic washing machine. Some of the things we considered before purchasing this are:

    • Company – Not all brands are equally reputed. Some of them tend to be more popular than the others for washing machines. From what I had heard, Whirlpool, LG and Samsung are most reputed. Not that others brands are not good, but we chose to buy one from the regular brands.
    • Front Load or Top Load – Front Load washing machines generally use lesser water and electricity and are more gentle on clothes than top load washing machines. For further differences and some technical explanation, you can refer http://housewares.about.com/lw/Home-Garden/Home-improvement-renovation/Top-Loading-vs-Front-Loading-Washers-Which-is-Better-.htm and http://ezinearticles.com/?Front-Load-vs-Top-Load-Washer—Which-One-To-Choose&id=367499.
    • Capacity – Washing machine capacity generally vary from 5 Kg to 7 Kg. 1 Kg can be considered to be equal to a pair of clothes (i.e. shirt + trouser / shalwar + kameez) or a single jeans (this is because jeans tend to be heavier than the regular cotton trousers). So 5.5 Kg meant we could wash upto 6 pairs of clothes at a time. As we are only two, we felt a 5.5 Kg capacity washing machine would suit our purpose better. For families of size greater than four, a 7 Kg washing machines might be better suited though.
    • Half Load Cycle – Some of the washing machines also come with an option for half-load which means by setting it to half-load, you could wash half the number of clothes as its maximum capacity thereby using lesser water and energy. This might be a good option when you just have two or three paris of soiled clothes and you immediately need to use one among them.
    • Semi-automatic vs. fully automatic – Semi-automatic washing machines have a separate washer and dryer. Once the washing of clothes is over, clothes have to be manually transferred from the washer to the dryer compartment. Having a fully automatic washing machine avoids this process.
    • After sales support – One really important factor to consider which is often ignored is after sales support. A washing machine is a costly investment and good after sales support is a must for such a product.

    While top-load semi automatic washing machines will be cheaper than front-load fully automatic washing machines, I’d highly recommend the latter because of its use of lesser resources and lesser manual intervention. Also, keep in mind that if you raise the temperature for washing highly soiled clothes, there is a chance that some of the clothes might get discoloured.

    I hope this small guide will be useful when you consider buying a washing machine.

  • Moved To A New House

    About two months back, Veena (my wife) and I moved to a new house. I’ve been thinking about blogging on this since then but just couldn’t take the time out. Anyway, here is my experience so far on moving out of my parents’ home.

    Veena and I initially hired a broker to help us look for a house. We felt it would ease the process of finding a house. We did not like any of the houses the broker showed us. We continued looking for a house by ourselves and finally decided on a double-bedroom apartment. While we initially thought of going for a single bedroom apartment, we felt it would not be very convenient when Veena’s parents come over for a visit. Though the rent was slightly over our budget, we decided to go for it as it was a new house, very spacious and the ventilation was really good. The first couple of weeks after we moved in were slightly chaotic. It took us about a month to move all the luggage. During this one month, Veena’s parents also paid a visit.

    We follow more or less a regular schedule. Personally, I prefer not having a maid and automating the daily chores as far as possible. During the weekend we purchase the groceries for the entire week. We split the household chores between us – I cut the vegetables and Veena does the cooking, Veena does the sweeping and I do the mopping :). The refrigerator helps to keep the food fresh for 3-4 days because of which are able manage by generally cooking only twice weekly, with 3-4 curries each time. We purchased a Panasonic rice cooker which again is a boon for cooking rice daily. Another really useful purchase we have made is the Whirlpool ABM551 5.5 Kg front load fully automatic washing machine (I am going to write a complete article on this). Among the other not-so-common electrical appliances we are considering purchasing are Robocleanz (automatic Eureka Forbes Vacuum cleaner), Food Processor (which I believe will help me in chopping vegetables) and a Dishwasher. But I am looking for some feedback on these before I purchase them.

    Life was always hectic and it got all the more hectic after I’ve moved into the new home. But I think it is time I learn how to balance life :). I feel bad that I’ve not been blogging much of late. So to make up for that I decided that I’d write at least a few articles this weekend.

  • Maternal Grandmother Passes Away

    On April 12, 2010 at around 14:20, my maternal grandmother, Thirumala Devi, aged 75, succumbed to a heart attack. Her health had deteriorated considerably during her last few days and she had been bed-ridden for almost a month. May her soul rest in peace.

  • Update

    With my wife, Veena, not getting a transfer immediately after marriage, I moved to Chennai for a couple of months. My stay in Chennai was at TGN Guest House. I’d like to mention a few words about my stay there so that this article will serve as a review for TGN Guest House as well.

    Among the various guest houses in Chennai we had considered, this was the only one other than http://www.chennaiguesthomes.com/ which came for a reasonable price. The 1 BHK guest house costed us Rs.12000 per month (exclusive of water and electricity charges). But we faced quite some problem with the service. For anything we needed, we had to call the owner, Babu many times. Also, though we were promised uninterrupted water supply, it was our responsibility to call up the water tanker provider everytime. Some of the main items such as Fridge, kitchen utensils, cots, etc. were provided very soon (on the day we moved in or within a week). But some of the smaller things such as mosquito meshes were postponed a lot. Though these were small issues, the delay caused us quite some inconvenience. Overall, Veena and I felt that the owner was not greedy for money but the service was bad (this could be because he had employed less number of persons).

    Anyway, I returned to Hyderabad on Feb 21 and since then, it has been an extremely hectic schedule. We should be soon moving to a new home and I hope things will settle down by then.

  • Obtaining a Marriage Certificate (Secunderabad, India)

    Having applied for a marriage certificate today, I am documenting the procedure here so that it is useful for someone. I got married according to the Hindu Marriage Act and the details given here are mainly applicable for this Act. For the Special Marriage Act or further information on the Hindu Marriage Act, kindly visit:

    http://india.gov.in/howdo/howdoi.php?service=3
    http://india.gov.in/howdo/service_detail.php?service=3

    • The certificate has to be applied to the Registrar in whose jurisdiction either the bridegroom or bride has been residing for more than 6 months immediately preceding the date of marriage. (As per one of the links given above, it should also be possible to apply to the Registrar in whose jurisdiction the marriage was solemnized)
    • As per the law, the Hindu Marriage Act has to be registered within one month from the date of solemnization of the marriage. If it is delayed, it can be condoned by the Sub-Registrar upto 5 years. Beyond that, the District Registrar has to condone it.
    • A form “Form A” has to be filled for filing for the marriage certificate. This form can be got from the office itself.
    • Below are the documents which you will need to furnish for a marriage certificate.
      Wedding Invitation
      Marriage Photo (We were insisted to get a photo in which I was tying the knot to my wife. Also we were asked for an additional photo. So better keep at least two photos)
      Age Proof (For age proof, my driving licence was rejected as a proof. So you will need to furnish some other proof such as Passport or Voter Card)
      Residence Proof
      Photo ID proof
    • Both the bridegroom and the bride have to be present while applying for the certificate. Additionally three witness have to be present as well.
    • In case it has been more than a month since the solemnization of your marriage, then both the bridegroom and the bride have to fill an additional form (two copies, one by bridegroom and one by the bride) requesting the Registrar to condone the delay. These forms have to be attested with two 2-rupees Court fee stamps, one on each copy.
    • The cost for the marriage certificate is Rs.20. You will be provided with a token asking you to come back a couple of days later to collect the marriage certificate.
  • BackupPC with Lighttpd in DD-WRT

    This tutorial covers the necessary steps to get BackupPC up and running on any device (such as the Linksys router WRT 610N) which has DD-WRT firmware installed on it.

    In case there are any steps which I have missed, kindly mention them in the comments section, and I will update the main article accordingly.

    Installing DD-WRT Firmware

    The first step obviously is to install the right DD-WRT firmware on your device. The instructions for this are beyond the scope of this tutorial. It should be noted that certain K26 builds have swap disabled. Make sure that swap is enabled in the firmware which you are installing.

    After installing DD-WRT, go to Setup->Basic Setup->Time Settings and enable NTP Client. I suggest you leave the timezone as UTC because setting any other timezone will make the system time go out of sync with DD-WRT time (this can be seen when you log into the router via SSH and type the “date” command).

    Enabling SSH

    Next you will have to enable SSH in DD-WRT. For this, you will have to enable the SSH server in Services -> Services -> Secure Shell -> SSHd. Make sure that you are able to SSH successfully to your router as user ‘root’.

    Checking internet access
    As soon as you log into the router via SSH, you need to check access for internet connectivity. This can be done by simply doing a ping on google.com. If your router is set up with proper internet connectivity, then you should get a proper ping response as below.

    # ping -c 3 google.com
    PING google.com (216.239.59.99): 56 data bytes
    64 bytes from 216.239.59.99: icmp_seq=0 ttl=51 time=295.261 ms
    64 bytes from 216.239.59.99: icmp_seq=1 ttl=51 time=298.034 ms
    64 bytes from 216.239.59.99: icmp_seq=2 ttl=51 time=301.029 ms
    --- google.com ping statistics ---
    3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max/stddev = 295.261/298.108/301.029/2.355 ms
    

    In my case though, my router was actually being used as a switch. Therefore I had to perform the below two additional steps to make internet accessible from within it:

    1. In Setup -> Basic Setup -> Network Setup -> Gateway, I had to give the IP address of the gateway.
    2. Next I had to add DNS servers. In order to do this at boot time, I appended the following line to Administration -> Commands -> Startup at the beginning:
      echo -e "nameserver 208.67.222.222\nnameserver 208.67.220.220" >> /tmp/resolv.conf

      This means that whenever the router starts it will add these two nameservers (which are those of OpenDNS) to /etc/resolv.conf.

      Alternatively, if you have enabled DHCP server, you can also try to setup OpenDNS (or any static DNS) by following the instructions at http://www.dd-wrt.com/wiki/index.php/OpenDNS#Basic_Setup.

    Setting up Optware
    Follow the instructions mentioned in http://www.dd-wrt.com/wiki/index.php/Optware%2C_the_Right_Way to set up your system with optware. The instructions are very clear and you should not face a lot of difficulty in setting it up.

    • Make sure that the size of the /opt partition is 1 GB (as we will be running a lot of installations) and the size of the swap space is at least 512 MB because BackupPC requires a lot of memory. Running the “free” command in the router should show give you memory details.
      # free
                   total       used       free     shared    buffers     cached
      Mem:         59984      58500       1484          0      28352      12568
      -/+ buffers/cache:      17580      42404
      Swap:      1052248       7868    104438
      
    • “ipkg-opt” is the utility which we use for package maintenance (this is similar to apt-get / yum). Just entering ipkg-opt without any arguments, should list all the available sub-commands (the most useful of them being “update”, “remove”, “install”, “list”, “files” and “search”).
      # ipkg-opt
      # ipkg-opt update
      
    • When using USB storage (or maybe other form of storage as well), in order to automount the remaining partitions, the packages ‘util-linux-ng’ and ‘grep’ should be installed as well. Restarting the automount service after installing these packages should mount the partitions.
      # ipkg-opt install util-linux-ng grep
      # service automount stop
      # service automount start
      

    BackupPC dependencies

    The documentation for BackupPC is available at http://backuppc.sourceforge.net/faq/BackupPC.html. First we need to install BackupPC dependencies mentioned in this page.

    • Most of the dependencies are installed while setting up Optware in the previous section. I will cover the remaining or the most important packages here:
      # ipkg-opt install perl
      # ipkg-opt install samba2
      # ipkg-opt install tar
      # ipkg-opt install rsync
      # ipkg-opt install par2cmdline 
      
    • The default SSH client provided by dd-wrt (at /usr/bin/ssh) might not be very useful to use with BackupPC because of its limited set of options. Therefore we install openssh package which should install the OpenSSH client at /opt/bin/ssh.
      # ipkg-opt install openssh
      

      But it should be noted that this package will also install the OpenSSH server. This has to be disabled so that it does not conflict with the default SSH server provided by DD-WRT. Therefore in /opt/etc/default/openssh, change

      SSHD_ENABLE=yes

      to

      SSHD_ENABLE=no

      This should prevent OpenSSH server from starting at boot time.

    • Apart from the above utilities, BackupPC has the following perl modules as dependencies – Compress::Zlib, Archive::Zip, File::RsyncP and XML::RSS.
      1. Compress::Zlib can be installed directly from the optware repo.
        # ipkg-opt install perl-compress-zlib
        
      2. Similarly, Archive::Zip can be installed directly from the optware repo.
        # ipkg-opt install perl-archive-zip
        
      3. For File::RsyncP, first we set up the build environment. This build environment will also be useful for installing other perl modules. Then we download the source from Perl CPAN and install it.
        # ipkg-opt remove wget
        # ipkg-opt install buildroot optware-devel
        
        # wget http://search.cpan.org/CPAN/authors/id/C/CB/CBARRATT/File-RsyncP-0.68.tar.gz
        # tar zxvf File-RsyncP-0.68.tar.gz
        # cd File-RsyncP-0.68
        # perl Makefile.PL
        # make CC=mipsel-linux-uclibc-gcc AR=ar LD=ld LINKTYPE=dynamic LDDLFLAGS="-shared -O2"
        # make CC=mipsel-linux-uclibc-gcc AR=ar LD=ld LINKTYPE=dynamic LDDLFLAGS="-shared -O2" test
        # make CC=mipsel-linux-uclibc-gcc AR=ar LD=ld LINKTYPE=dynamic LDDLFLAGS="-shared -O2" install
        
      4. Our last perl module, XML::RSS, has a lot of dependencies (this can be seen clearly in http://deps.cpantesters.org/?module=XML%3A%3ARSS&perl=5.8.8&os=any+OS). Therefore, following the steps similar to those mentioned in http://www.livejournal.com/doc/server/lj.install.perl_setup.modules.html, we can install from CPAN directly. Please note that XML::RSS module is necessary only if you plan to use BackupPC RSS feed. As I was not planning to use the RSS feed and the installation of the module was taking long, I chose to ignore this dependency. Therefore the below steps are not tested.

        First we start the CPAN shell.

        # export CC=mipsel-linux-uclibc-gcc AR=ar LD=ld LINKTYPE=dynamic LDDLFLAGS="-shared -O2"
        # perl -MCPAN -e shell
        cpan>
        

        (Optional) Upgrade the CPAN module.

        cpan> install Bundle::CPAN
        cpan> reload cpan
        

        Finally, install XML::RSS perl module.

        cpan> install XML::RSS
        cpan> exit
        

    Installing BackupPC

    Next we come to the installation of BackupPC. First download the package from http://backuppc.sourceforge.net/. Next run these commands.

    # tar -xvzf BackupPC-3.1.0.tar.gz
    # cd BackupPC-3.1.0
    # perl configure.pl --config-dir=/opt/etc/backuppc --log-dir=/opt/var/log/backuppc 
    
    Is this a new installation or upgrade for BackupPC?  If this is
    an upgrade please tell me the full path of the existing BackupPC
    configuration file (eg: /etc/BackupPC/config.pl).  Otherwise, just
    hit return.                                                       
    
    --> Full path to existing main config.pl []? 
    
    I found the following locations for these programs:
    
        bzip2        => /opt/bin/bzip2
        cat          => /opt/bin/cat  
        df           => /opt/bin/df   
        gtar/tar     => /opt/bin/tar  
        gzip         => /opt/bin/gzip 
        hostname     => /opt/bin/hostname
        nmblookup    => /opt/bin/nmblookup
        par2         => /opt/bin/par2     
        perl         => /opt/bin/perl     
        ping         => /opt/bin/ping     
        rsync        => /opt/bin/rsync    
        sendmail     => /usr/sbin/sendmail
        smbclient    => /opt/bin/smbclient
        split        => /opt/bin/split    
        ssh/ssh2     => /opt/bin/ssh      
    
    --> Are these paths correct? [y]? n
    --> bzip2 path [/opt/bin/bzip2]?
    --> cat path [/opt/bin/cat]?
    --> df path [/opt/bin/df]?
    --> gtar/tar path [/opt/bin/tar]? /bin/tar
    --> gzip path [/opt/bin/gzip]?
    --> hostname path [/opt/bin/hostname]?
    --> nmblookup path [/opt/bin/nmblookup]?
    --> par2 path [/opt/bin/par2]?
    --> perl path [/opt/bin/perl]?
    --> ping path [/opt/bin/ping]?
    --> rsync path [/opt/bin/rsync]? /usr/bin/rsync
    --> sendmail path [/usr/sbin/sendmail]?
    --> smbclient path [/opt/bin/smbclient]?
    --> split path [/opt/bin/split]?
    --> ssh/ssh2 path [/opt/bin/ssh]?
    
    I found the following locations for these programs:
    
        bzip2        => /opt/bin/bzip2
        cat          => /opt/bin/cat
        df           => /opt/bin/df
        gtar/tar     => /bin/tar
        gzip         => /opt/bin/gzip
        hostname     => /opt/bin/hostname
        nmblookup    => /opt/bin/nmblookup
        par2         => /opt/bin/par2
        perl         => /opt/bin/perl
        ping         => /opt/bin/ping
        rsync        => /usr/bin/rsync
        sendmail     => /usr/sbin/sendmail
        smbclient    => /opt/bin/smbclient
        split        => /opt/bin/split
        ssh/ssh2     => /opt/bin/ssh
    
    --> Are these paths correct? [y]? 
    
    Please tell me the hostname of the machine that BackupPC will run on.
    
    --> BackupPC will run on host [DD-WRT]? 
    
    BackupPC should run as a dedicated user with limited privileges.  You
    need to create a user.  This user will need read/write permission on 
    the main data directory and read/execute permission on the install   
    directory (these directories will be setup shortly).                 
    
    The primary group for this user should also be chosen carefully.
    The data directories and files will have group read permission, 
    so group members can access backup files.                       
    
    --> BackupPC should run as user [backuppc]? root
    
    Please specify an install directory for BackupPC.  This is where the
    BackupPC scripts, library and documentation will be installed.      
    
    --> Install directory (full path) [/usr/local/BackupPC]? /opt/local/backuppc
    
    Please specify a data directory for BackupPC.  This is where all the
    PC backup data is stored.  This file system needs to be big enough to
    accommodate all the PCs you expect to backup (eg: at least several GB
    per machine).                                                        
    
    --> Data directory (full path) [/data/BackupPC]? /mnt/backuppc
    
    BackupPC can compress pool files, providing around a 40% reduction in pool
    size (your mileage may vary). Specify the compression level (0 turns      
    off compression, and 1 to 9 represent good/fastest to best/slowest).      
    The recommended values are 0 (off) or 3 (reasonable compression and speed).
    Increasing the compression level to 5 will use around 20% more cpu time    
    and give perhaps 2-3% more compression.                                    
    
    --> Compression level [3]? 
    
    BackupPC has a powerful CGI perl interface that runs under Apache.
    A single executable needs to be installed in a cgi-bin directory. 
    This executable needs to run as set-uid backuppc, or              
    it can be run under mod_perl with Apache running as user backuppc.
    
    Leave this path empty if you don't want to install the CGI interface.
    
    --> CGI bin directory (full path) []? /opt/share/www/backuppc/cgi-bin
    
    BackupPC's CGI script needs to display various GIF images that
    should be stored where Apache can serve them.  They should be 
    placed somewhere under Apache's DocumentRoot.  BackupPC also  
    needs to know the URL to access these images.  Example:       
    
        Apache image directory:  /usr/local/apache/htdocs/BackupPC
        URL for image directory: /BackupPC                        
    
    The URL for the image directory should start with a slash.
    
    --> Apache image directory (full path) []? /opt/share/www/backuppc
    --> URL for image directory (omit http://host; starts with '/') []? /backuppc
    
    Ok, we're about to:
    
      - install the binaries, lib and docs in /opt/local/backuppc,
      - create the data directory /mnt/backuppc,                  
      - create/update the config.pl file /opt/etc/backuppc/config.pl,
      - optionally install the cgi-bin interface.                    
    
    --> Do you want to continue? [y]? 
    Created /mnt/backuppc             
    Created /mnt/backuppc/pool        
    Created /mnt/backuppc/cpool       
    Created /mnt/backuppc/pc          
    Created /mnt/backuppc/trash       
    Created /opt/etc/backuppc         
    Created /opt/var/log/backuppc     
    Installing binaries in /opt/local/backuppc/bin
    Installing library in /opt/local/backuppc/lib 
    Installing images in /opt/share/www/backuppc  
    Making init.d scripts                         
    Installing docs in /opt/local/backuppc/doc    
    Installing config.pl and hosts in /opt/etc/backuppc
    /opt/bin/ping: illegal option -- w                 
    ?: not implemented                                 
    Installing cgi script BackupPC_Admin in /opt/share/www/backuppc/cgi-bin
    
    Ok, it looks like we are finished.  There are several more things you
    will need to do:                                                     
    
      - Browse through the config file, /opt/etc/backuppc/config.pl,
        and make sure all the settings are correct.  In particular, 
        you will need to set $Conf{CgiAdminUsers} so you have       
        administration privileges in the CGI interface.             
    
      - Edit the list of hosts to backup in /opt/etc/backuppc/hosts.
    
      - Read the documentation in /opt/local/backuppc/doc/BackupPC.html.
        Please pay special attention to the security section.           
    
      - Verify that the CGI script BackupPC_Admin runs correctly.  You might
        need to change the permissions or group ownership of BackupPC_Admin.
        If this is an upgrade and you are using mod_perl, you will need     
        to restart Apache.  Otherwise it will have stale code.              
    
      - BackupPC should be ready to start.  Don't forget to run it
        as user backuppc!  The installation also contains an      
        init.d/backuppc script that can be copied to /etc/init.d  
        so that BackupPC can auto-start on boot.  This will also enable
        administrative users to start the server from the CGI interface.
        See init.d/README.                                              
    
    Enjoy!
    

    BackupPC init.d script

    Now we create the BackupPC init.d script to automatically start and stop the service. For this, first create a file /opt/etc/init.d/S95backuppc with the following content:

    #!/bin/sh
    
    export PATH=/opt/bin:/opt/sbin:/opt/usr/sbin:$PATH
    export LD_LIBRARY_PATH=/opt/lib:/opt/usr/lib:$LD_LIBRARY_PATH
    
    NAME=backuppc
    
    start() {
        #
        # You can set the SMB share password here is you wish.  Otherwise
        # you should put it in the config.pl script.
        # If you put it here make sure this file has no read permissions
        # for normal users!  See the documentation for more information.
        #
        #BPC_SMB_PASSWD=
        #export BPC_SMB_PASSWD
        #
        /opt/local/backuppc/bin/BackupPC -d
    }
    
    stop() {
        killall -9 BackupPC
    }
    
    restart() {
        stop
        start
    }
    
    reload() {
        killall -1 BackupPC
    }
    
    if [ -z "$1" ] ; then
        case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
            S??*) rc="start" ;;
            K??*) rc="stop" ;;
            *) rc="usage" ;;
        esac
    else
        rc="$1"
    fi
    
    case "$rc" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      restart)
            restart
            ;;
      reload)
            reload
            ;;
      *)
            echo "Usage: $0 {start|stop|restart|reload}"
            exit 1
    esac
    
    exit $?
    

    Now we link the stop script to this.

    # cd /opt/etc/init.d/
    # ln -s S95backuppc K05backuppc
    

    Finally we enable backuppc and start it.

    # service backuppc on
    # service backuppc start
    

    Configuring Lighttpd for BackupPC

    If you do not want a web interface, this section can be ignored. But I highly recommend you get the web interface for BackupPC up and running as it eases administration a lot. For using the BackupPC web interface, we can use Lighttpd web server.

    • Lighttpd gets installed by default when you setup Optware. But it is disabled. Therefore first we enable and start it.
      # service lighttpd on
      # service lighttpd restart
      
    • The log directory for Lighttpd is /opt/var/log/lighttpd/. When I started Lighttpd, I found the error ‘Error “fdevent_init failed”‘ in /opt/var/log/lighttp/error.log. Luckily, I found the fix for this error at http://www.mattgibson.ca/2009/11/05/fix-dd-wrt-lighttpd-error-server-c-1105-fdevent_init-failed-on-asus-wl-500/. To fix this error, in /opt/etc/lighttpd/lighttpd.conf, change
      # server.event-handler = "freebsd-kqueue" # needed on OS X

      to

      server.event-handler = "poll" # needed on OS X

      Restart Lighttpd once you have made this change.

      # service lighttpd restart
      

      and visit http://<<ROUTER_IP>>:8081/ to make sure that the server is running properly (you should see a page which displays the message “lighttpd server is running.”).

    • Now we perform the below steps to enable BackupPC web interface (most of these steps have been taken from http://backuppc.wiki.sourceforge.net/Install+Backuppc+with+Lighttpd). These changes have to be done in /opt/etc/lighttpd/lighttpd.conf.

      Edit this section to enable the needed Lighttpd server modules (mod_auth, mod_cgi):

      ## modules to load
      # at least mod_access and mod_accesslog should be loaded
      # all other module should only be loaded if really neccesary
      # - saves some time
      # - saves memory
      server.modules              = (
      #                               "mod_rewrite",
      #                               "mod_redirect",
      #                               "mod_alias",
                                      "mod_access",
      #                               "mod_cml",
      #                               "mod_trigger_b4_dl",
                                      "mod_auth",
      #                               "mod_status",
      #                               "mod_setenv",
      #                               "mod_fastcgi",
      #                               "mod_proxy",
      #                               "mod_simple_vhost",
      #                               "mod_evhost",
      #                               "mod_userdir",
                                      "mod_cgi",
      #                               "mod_compress",
      #                               "mod_ssi",
      #                               "mod_usertrack",
      #                               "mod_expire",
      #                               "mod_secdownload",
      #                               "mod_rrdtool",
                                      "mod_accesslog" )
      

      Edit this section to add index.cgi as an authorized index file:

      # files to check for if .../ is requested
      index-file.names            = ( "index.php", "index.html",
                                      "index.htm", "default.htm",
                                      "lighttpd/index.html",
                                      "index.cgi" )
      

      Edit this section in your configuration file to assign cgi files to the perl binary:

      #### CGI module
      cgi.assign                 = ( ".pl"  => "/opt/bin/perl",
                                     ".cgi" => "/opt/bin/perl" )
      #
      

      Edit this section to password protect backuppc.

      #### auth module
      ## read authentication.txt for more info
      auth.backend               = "plain"
      auth.backend.plain.userfile = "/opt/etc/lighttpd/lighttpd.user"
      #auth.backend.plain.groupfile = "lighttpd.group"
      
      #auth.backend.ldap.hostname = "localhost"
      #auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
      #auth.backend.ldap.filter   = "(uid=$)"
      
      auth.require               = ( "/backuppc/" =>
                                     (
                                       "method"  => "basic",
                                       "realm"   => "BackupPC",
                                       "require" => "user=root"
                                     ),
      #                               "/server-config" =>
      #                               (
      #                                 "method"  => "digest",
      #                                 "realm"   => "download archiv",
      #                                 "require" => "valid-user"
      #                               )
                                   )
      

      You will have to create lighttpd.user which contains username and the cleartext password seperated by a colon. Each entry is terminated by a single newline. e.g.:

        agent007:secret
      

      See /opt/share/doc/lighttpd/authentication.txt for available authentication methods and backends.

    • Next link index.cgi to the BackupPC cgi script.
      # cd /opt/share/www/backuppc
      # ln -s cgi-bin/BackupPC_Admin index.cgi
      

      And finally restart Lighttpd.

      # service lighttpd restart
      
    • The BackupPC web interface should now be accessible at: http://<<ROUTER_IP>>:8081/backuppc/.

      Using Backuppc user (backuppc) instead of root

      Personally I find it convenient to run BackupPC as root and as I do not use the router for any other service, I do not see much of a security hassle. But some of you might want to run BackupPC as another less privileged user due to some reason. Kindly note that the below steps have not been tested and are here only to give you a basic direction to run BackupPC as another user.

      • First it should be noted that whenever you add a user/group, this information gets lost whenever the router reboots. Therefore we have to add the steps for creating a user/group in the router Startup script. In the router web interface, go to Administration->Commands->Startup and add the below lines at the top and restart the router.

        echo "backuppc:x:1000:" >> /tmp/etc/group
        echo "backuppc:x:1000:1000:BackupPC,,,:/mnt/backuppc:/bin/sh" >> /tmp/etc/passwd
        chgrp backuppc /tmp/etc/
        chmod g+rx /tmp/etc/
        
      • Now while performing installation of the BackupPC (refer section “Installing BackupPC” above), when it prompts for the user BackupPC should run as, just press enter and let it take the default username of “backuppc”.
      • Next for the BackupPC init.d script, replace the startup command

        /opt/local/backuppc/bin/BackupPC -d

        with

        su backuppc -c "/opt/local/backuppc/bin/BackupPC -d"
      • Lastly for configuring Lighttpd to serve the BackupPC web interface, you can follow the relevant steps in http://backuppc.wiki.sourceforge.net/Install+Backuppc+with+Lighttpd.
      • Making BackupPC consume lesser resources

        Here is a response I got from a post I made to BackupPC mailing list reg. making BackupPC consume lesser resources.

        On Thu, 2010-12-16 at 08:25 +0530, Rahul Amaram wrote:
        > > For example, I think that the BackupPC pooling mechanism while very 
        > > useful is resource-intensive. Is it possible to disable BackupPC pooling 
        > > or add such an option to BackupPC in the future releases?
        That's pretty much the core idea behind BackupPC.
        
        If you just want to reduce CPU load, disable compression in the pool,
        and enable rsync checksum caching. That will help a great deal.
        
        Regards,
        Tyler
        
  • SFTP Console Client with Recursive Download/Upload Support

    I often find it difficult to use ‘scp’ program because I don’t know the exact path to the directory in the destination server and I do not find ‘sftp’ program very useful because it does not support recursive downloads. Here are two programs which offer recursive downloads over sftp protocol:

    1. psftp provided by package putty-tools

    # psftp user@server
    psftp> get -r directory_to_download
    psftp> put -r directory_to_upload

    2. lftp provided by package lftp. It seems that lftp is much more advanced than psftp but the commands might be slightly different from the ones we use in ‘sftp’ program.

    # lftp sftp://user@server
    lftp> mirror directory_to_download
    lftp> mirror -R directory_to_upload

    And if you are looking for a really good sftp GUI client, then I highly recommend ‘Filezilla’.

    The best part is that all these tools are available in the Debian Lenny repo.

  • Open Source And Free Software

    Here is a little something for those new to the terms or those who are confused between these two terms.

    For quite sometime, I had this simple idea:

    Open Source – Software for which source is available
    Free Software – Software for which we do not have to pay

    Well, this was way back and while the first definition is partially correct, the second definition is totally wrong. Actually software for which source is available is generally referred to as “source-available” software and software which are available for free are generally called “freeware”. Also both free and open source software are also “source-available” software but a “source-available” software need not be free / open source. More on this later.

    Eventually I got to know the meaning of free software. But I was always wondering about the difference between free software and open source until I came across this article by Richard Stallman where he clearly explains the difference between free software and open source:

    http://www.gnu.org/philosophy/open-source-misses-the-point.html

    I will try to briefly explain some of these terms for the layman.

    Source (or source code) vs. Binary (or binary executables)

    Software is generally written in human readable format by programmers. This is called the source or source code. These files are then complied to produce binary executables which are not human readable. These binary files are then executed by the user to perform specific activities. Let us take the simple example of Adobe Acrobat Reader (Adobe acrobat reader is used for reading PDF files). This is how it works.

    The programmers at Adobe write thousands of lines of code. They then compile all this code to make the Adobe Reader binary. They then give these binaries to the people so that they can run it and read PDF files.

    Here let me add a point about binaries. Binaries are essentially not human readable files. Which means by looking at a binary or by examining it, it is generally very difficult to tell what it can do. For example, by running the Adobe Reader binary you might be able to read PDF files. However, apart from that. the same binary could also be collecting some information such as the kind of PDF files you often read and send this information to Adobe.

    Therefore the actual list of activities which a binary can perform can only be known to one who has access to the source code from which the binary was compiled. So, in the above mentioned case, only those at Adobe will actually know what the binary performs because only they have access to its source code. Theoretically it is possible to study the Adobe binary and tell what it can do but like I already mentioned, this is extremely difficult when compared to going through the source code and understanding what the program does.

    Summarizing, below are the steps involved in using a software:

    1. Source code which is in human readable format is written by programmers
    2. This is compiled to form binaries which are not human readable
    3. These binaries are executed by users (like you and me) to perform a specific task

    This is the way every software, be it proprietary, free or open source, generally works. It should be noted though, that for some programs written in interpreted languagues such as perl/python, there is no need for intermediate binary and the interpreter can execute the program by reading instructions directly from the source files.

    Proprietary/Non-free Software

    Let me give you an example of proprietary software – “Microsoft Windows operating system”. I believe most of you have been using this for quite sometime. But here are some facts about Windows OS.

    – Legally in order to use the Windows OS, you have to purchase it. Most of us end up using pirated Windows and if Microsoft gets to know of this, you could as well be jailed. Anyway, let us assume that you are a law-abiding citizen and have purchased a legal copy of Windows OS.

    – Though you have purchased the windows OS, the source of windows is never given to the end users. Only the binaries are given. Which means it is very difficult to tell what all your operating system is performing; it could as well be sending information about you to the government or to some third-party source. This itself could mean that your privacy is compromised.

    – The Windows license also does not allow you to distribute their OS. So though you have purchased Windows legally, you do not have the right to distribute it to your friends because the windows licence does not allow it.

    – You cannot study or make any changes to the operating system to suit your needs. Note that binaries are not human readable and hence you cannot make any changes to it directly. You have to modify the source code to add your changes and then recompile it to give you your new binary. But as the source code is not available, you cannot make any changes to the source code which means you are limited to using the Windows binaries which they have given.

    Have you ever wondered that you are actually using an operating system for which you have paid a price and yet cannot distribute it, cannot modify it and don’t know what all activities it is performing without your knowledge?

    Free Software

    As an answer to proprietary software, free software came into existence. Quoting Stallman – “When we call software “free,” we mean that it respects the users’ essential freedoms: the freedom to run it, to study and change it, and to redistribute copies with or without changes. This is a matter of freedom, not price, so think of “free speech,” not “free beer.””

    So free software does not mean that it could be got for zero price. It means that once you have got the software (either by buying it or for zero price), you get to enjoy these four freedoms.

    * Freedom 0: The freedom to run the program for any purpose.
    * Freedom 1: The freedom to study how the program works, and change it to make it do what you wish.
    * Freedom 2: The freedom to redistribute copies so you can help your neighbor.
    * Freedom 3: The freedom to improve the program, and release your improvements (and modified versions in general) to the public, so that the whole community benefits.

    Freedoms 1 and 3 require source code to be available because studying and modifying software without its source code is highly impractical.

    Open Source Software

    Open source software just doesn’t mean software for which source code is available. Similar to free software, open source software lets the user study, modify and distribute the source code. The software for which source is available are called “source-available” software. But not all “source-available” software let you modify or distribute it. Therefore one can say that all open source software are “source-available” but not all “source-available” software are open source or free software.

    Going by the official definition – “Open source is a development method for software that harnesses the power of distributed peer review and transparency of process. The promise of open source is better quality, higher reliability, more flexibility, lower cost, and an end to predatory vendor lock-in.”

    The idea behind open source is simple: By letting all the people of the world have access to the code and allowing them to study, make changes and give those changes back to the community, we will eventually have a better piece of software as opposed to a small number of developers working on developing a proprietary software without letting anyone else review this code.

    Free Software vs. Open Source

    The best way to understand the difference between both of these terms is by going through the link – http://www.gnu.org/philosophy/open-source-misses-the-point.html. Here are a few points from the same article which should help you to understand the difference:

    • Nearly all open source software is free software. The two terms describe almost the same category of software, but they stand for views based on fundamentally different values. Open source is a development methodology; free software is a social movement. For the free software movement, free software is an ethical imperative, because only free software respects the users’ freedom. By contrast, the philosophy of open source considers issues in terms of how to make software “better”—in a practical sense only. It says that nonfree software is an inferior solution to the practical problem at hand. For the free software movement, however, nonfree software is a social problem, and the solution is to stop using it and move to free software.
    • The idea of open source is that allowing users to change and redistribute the software will make it more powerful and reliable. But this is not guaranteed. Developers of proprietary software are not necessarily incompetent. Sometimes they produce a program that is powerful and reliable, even though it does not respect the users’ freedom. Free software activists and open source enthusiasts will react very differently to that.

      A pure open source enthusiast, one that is not at all influenced by the ideals of free software, will say, “I am surprised you were able to make the program work so well without using our development model, but you did. How can I get a copy?” This attitude will reward schemes that take away our freedom, leading to its loss.

      The free software activist will say, “Your program is very attractive, but I value my freedom more. So I reject your program. Instead I will support a project to develop a free replacement.” If we value our freedom, we can act to maintain and defend it.

    • Under pressure from the movie and record companies, software for individuals to use is increasingly designed specifically to restrict them. This malicious feature is known as Digital Restrictions Management (DRM) (see DefectiveByDesign.org and is the antithesis in spirit of the freedom that free software aims to provide. And not just in spirit: since the goal of DRM is to trample your freedom, DRM developers try to make it hard, impossible, or even illegal for you to change the software that implements the DRM.

      Yet some open source supporters have proposed “open source DRM” software. Their idea is that, by publishing the source code of programs designed to restrict your access to encrypted media and by allowing others to change it, they will produce more powerful and reliable software for restricting users like you. The software would then be delivered to you in devices that do not allow you to change it.

      This software might be open source and use the open source development model, but it won’t be free software since it won’t respect the freedom of the users that actually run it. If the open source development model succeeds in making this software more powerful and reliable for restricting you, that will make it even worse.

    • I hope this article has helped you in gaining an initial understanding of software freedom. Googling for free software and open source software should give you a lot of links where you can get a better understanding of these terms.

      I’d like to thank my friend Sunil Mohan for reviewing this article and giving his valuable feedback.

  • kolkatacabs.com (Kolkata Cabs) review

    I had recently been on a visit to Kolkata with my wife and I had to book a cab for a day. After searching for cab services in Kolkata, I came across http://kolkatacabs.com. The tariffs they offered seemed to be decent and we were able to book a cab (an Indigo) just one day before. But our experience with the driver was bad. He was not very responsive. But this is not my major complaint. He tried to cheat us. I took the reading of the meter when we boarded the cab and at the end of the day I realized that he modified the entry written in the slip to add an extra 40 kms. Upon arguing with him, he agreed not to charge for those extra 40 kms. Not only this, I am sure he produced more than the actual number of parking bills. I strongly recommend that you stay away from this cab service.


    Update 14 Dec, 2009: I put a mail via the enquiry form on their website informing about the same and I am at least not disappointed in that they replied to me promptly. Below is their reply. I shall update this post in case I get to hear from them again on this issue.

    “Respected Sir/Madam

    We will definitely look after this matter & please contact Mr. Soudip(M)9831492956 before you book any cab.”