Prevent Directory Listing in Lighttpd

How to prevent files under wp-content/uploads to be listed in the browser? It is actually a one-liner under Lighttpd (lighty).

Edit /etc/lighttpd/lighttpd.conf and change server.dir-listing into disable.

 server.dir-listing          = "disable"

If you choose to enable directory listing, you can set the encoding of the file names to be displayed:

 dir-listing.encoding        = "utf-8"

There are wonderful resources about lighty in the following two sites: Flexion.Org and

Debian Squeeze minior tweaks

Yes, I upgraded from Debian Lenny to Squeeze because I need ibus to replace scim as my default Chinese input program. So far the experience with ibus is good but the same was half-true with Squeeze. I spent quite some time to make Squeeze more comfortable to use.

Touchpad tapping and scrolling

I need to create an option file under /etc/modprobe.d to enable tapping and scrolling. Just create a file with any name under modprobe.d and put the following line into it:

options psmouse proto=imps

Undervolting core2duo CPU

Under Windows you have the convenient way to use rmclock to undervolt the CPU to reduce the heat generated by CPU operations. Linux has the equivalent method, but only a little harder. The answer is Linux PHC. To implement it as quickly as you can, the following steps are involved:

Compiling and installing it is fairly easy. You just need to have kernel-headers and build essentials (gcc, libc, make, etc). You do not need the kernel source to compile this kernel module.
Find the workable voltage for your CPU. You can use rmclock in Windows to select the voltage and write down the number or search the Internet for the limit of the undervolting for your CPU.
Use PHCTool (old version) to convert the voltage into VIDs (voltage IDs) for Linux PHC.


The voltage for my T7200 are translated into these four PHC VIDs 24 23 19 19. To pass these values, I edited /etc/init.d/rc.local and put the following two lines at the bottom of that file. Since I have two CPU cores, two lines are needed:

echo "24 23 19 19" > /sys/devices/system/cpu/cpu0/cpufreq/phc_vids
echo "24 23 19 19" > /sys/devices/system/cpu/cpu1/cpufreq/phc_vids

Underclocking Nvidia Geforce Go 7200

I have little luck with underclocking Geforce Go 7200 on my HP DV2000t laptop. By the way, this laptop is very hot and noisy so I don’t think I am gonna buy a HP lappy again. I basically followed the instructions by Artem and ended up putting the following lines into my /etc/X11/xorg.conf, but I am not sure if it worked or not. Maybe I should change the driver and try again?

Section "Device"
    Identifier     "NVIDIA GeForce"
    Driver         "nvidia"
    Option         "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x3333; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x3"
    VendorName     "NVIDIA Corporation"

ibus input method

ibus works great under Debian Squeeze. Just remember to run ibus-setup first and enable the pinyin input method for ibus to handle.

disabling auto-starting services

Bum (Boot-up Manager) is a great tool to view the system services and disable them. It is better than rcconf and sysv-rc-conf.


Capturing screen

The screenshot was taken by shutter under gnome. shutter is quiet powerful to use and its plugins can perform almost everything you want in a screen capturer. But it’s still a diamond in the rough because I struggled a little bit trying to find the resize function under this program. It turned out that resizing is supported by a plugin and it hides under the ‘screenshot’ menu. The screenshot of bum above is a an art of creation by shutter.

Convert mp3 tags into UTF-8

Install python-mutagen package first and then run this command in the directory of the mp3 files.

find .  -iname  "*.mp3"  -execdir  mid3iconv  -e  GBK  {}  ;

Java based program ID3iconv is also know to perform the same task.

Some say by setting an environment parameter in /etc/X11/Xsession.d/95setenv like this will save the hassle of running the tag conversion when you have new music

 echo "GST_ID3_TAG_ENCODING=GBK" > /etc/X11/Xsession.d/95setenv

Right now I am using Exaile as the music player. Too bad it does not allow me to sort music by directory sources like foobar in Windows.

More to come about the movie/music player and other cool stuff under Linux.

Postfix for WordPress

Setting up a basic single domain postfix mail server was not as difficult as I imagined. Configuring a postfix mail server is not rocket science, and here is what I did to configure postfix for my WordPress blog.

The Book

I highly recommend The Book Of Postfix published by No Starch in 2005. A reviewer on Amazon says it is better than the O’Reilly Postfix book, and I agree even if I didn’t read that O’Reilly book. After reading the first two chapters, I was able to configure a basic Postfix mail server.
What’s very important, as the book says, is preparing the host for Postfix.


In my case, I need to setup hostname and DNS MX records correctly from the onset.

  • Setting the hostname. To set hostname in Debian, edit /etc/hostname and put as my hostname.
  • Install dnsutils to for dig command. To check and modify DNS records, dig command will come in handy.
  • Modify DNS information. Find out the DNS MX records for my domain dig MX. I use the DNS server of, and I use its total domain control to modify my DNS MX record into Once correctly configured, dig shows this record:
  • 1800 IN MX 10

  • Install bsd-mailx to have mail command to test postfix. It is better than telnet method.

Install and Configure

For mail transfer functions of WordPress, I don’t need complications and installing postfix is suffice. A few steps prompted by debconf is enough to get the mail system working for WordPress. For now, I only want WordPress to use postfix on localhost, and disable the access of postfix from the rest of the world. I am not sure what to do to disable the feared Open Relay, but it seems the following lines in the do the trick:

mydestination =, localhost, localhost.localdomain, localhost
relay_domains = $mydestination
mynetworks = [::ffff:]/104 [::1]/128

The line relay_domains = $mydestination tells postfix only to relay mail for my own destinations.

Check if the Open Relay is enabled

Open Relay is the mail server admin’s nightmare.
Test the mail server domain at to see if Open Relay is enabled for postfix or not.

Putty with ssh key authentication

When using ssh keys generated by puttygen.exe, I receive a “Server refused our key” error. Then I found out that the error-proof way is this: generate ssh key pairs under Linux, and then convert the private key into putty format using puttygen.exe.


  • change ~/.ssh directory and authorized_keys permissions
chmod 700 .ssh
chmod 600 authorized_keys
  • generate the key pair. Most tutorials seems to prefer to use dsa format
ssh-keygen -t dsa
  • use the default file name and enter the passphrase
  • add the public key to authorized_keys
cat >> .ssh/authorized_keys
  • copy the private key (id_dsa) to the local windows machine. Then use puttygen.exe to convert the key and save it to a separate private key

Then configure the putty to use the new private key.

Additional notes

Under Debian Lenny, I don’t need to make any changes to /etc/ssh/ssh_config to make putty auto authentication work.

The putty does not authenticate with the public key, but with .ssh/authorized_keys instead, that’s why the public key should be copied to authorized_keys file.


ssh – authorized_keys HOWTO for some fundamentals

Enabling Webcam for HP DV2000T laptop under Lenny

Owning a slightly dated rig actually has one great benefit — the software for it is mature enough that not too much hacking or hair-tearing is needed. This is exactly the case for my two-year-old HP Pavilion DV2000t laptop. When staring installing Debian on it, I found the hardware is well supported.

Here is how to compile drivers for the webcam of this laptop.


Get the source from LinuxTV


Make sure build-essential is installed. Then just extract the file and make, make install.


Check to see if there is a usb video device

sudo lsusb -v

And use Cheese or any other video capable programs to use it.


Its website says “Linux 2.6.26 and newer includes the Linux UVC driver natively. You will not need to download the driver sources manually unless you want to test a newer version or help with development”, and machiner confirms “linux-uvc, sure enough, completely unnecessary now. You shouldn’t have to do anything to get your web cam working other than installing a program so you can see it”.

So it is even easier to enable the webcam under Linux .

Fine-tuning Debian Lenny Desktop

Linux is never perfect. One has to tweak it hither and tither to make it comfortable for daily use, to make it YOUR OS. In this post are kept the tweaks, hacks and fooling around recorded on my Debian journey.


In Gnome’s System menu, select Preferences > Preferred Applications and choose Iceweasel as the default browser. Running the following command in terminal also does the same thing.


Somehow, Debian’s built-in command update-alternatives --config x-www-browser does not work for this purpose


Gnome’s System–Preference–Sessions is a good to tool to decide which background processes to run or stop. However, if you accidentally chose “remember currently running applications”, things can get nasty as many unwanted programs will keep come back with persistence. After fighting with save sessions a few times, I decide to do it my own way — delete .gnome .gnome2 .gnome_private folders under my HOME directory. After logging back, the whole world is in peace.

Debian CN99 is back!

The fastest debian mirror site in China has just come back online. The once long standing went offline a few months ago without any notice or explanation from its administrators. Many Chinese debianers had been guessing when it would come back or if it ever would.

Today, to my great delight the the debian mirror server resurrected. Not only does it have debian mirrors, but also stores other popular distributions such as Ubuntu, Fedora, FreeBSD, OpenBSD, gentto and Archlinux.

The header.txt file in the root directory of Debian CN99 indicates the mirror server is now taken care of by one of the biggest Internet portal site in China:, which is also known as The header.txt says:

Welcome to Open source projects Archive on 163(aka
Mirror access is available at
Please email to for suggestions and/or questions.

This means debianers now can use as an alternative address to do apt-get.

With a giant Internet cooperation — — sponsoring the mirror server, I am reasonably expecting it to serve the community in a long period of time to come.

A Debian/Lenny User Experience — A Glass Half Full (Part II)

Now it is approaching the Chinese New Year — the Year of OX and I am in the mood of using Linux/Debian again. But this time I am not going to pretend I don’t hate the usability issues of Linux for a desktop environment. There are many applications under Linux which are touted as ‘replacements’ for Windows applications, luring Windows users to take the plunge and use Linux. While it is true that you can do the same thing under Linux, you will find many so called replacements have one thing in common: they stand in your way when you are using them to do the tasks.

Ironically, the very best desktop applications, I mean if they are really excellent and free, all come with Windows versions (vim, Firefox for example). Sad but true, the best and free desktop applications under Windows stay in Windows. The outcome of this situation is: Windows are still the best provider for a convenient desktop environment.

I’ll list some of the programs I use daily to demonstrate to the “free inferiority” of Linux desktop environment to that of MS Windows:

  • SCIM (the Smart Common Input Method) is the default tool I use to input Chinese. It’s input algorithm for Pinyin is no comparison for Google and Sogou Pinyin freely available under Windows. The result is I spend more time typing the same amounts of words.
  • Amarok and Rhythmbox can play the music alright. But they can’t delete the music file I don’t like on the fly with a shortcut. And deleting a music file under Rhythmbox doesn’t even work. Not to mention the garbled display of non UTF-8 ID3 Tags under the *nix players. Foobar2000 is still the best music player on this planet.
  • Nautilus File manager only have two views (detailed and icons) compared to four views of Windows Explorer. Dragging a music folder from it to Rhythmbox is impossible. By the way, pcmanfm, made by a Taiwanese, has a compact list view and a much smaller footprint.
  • Firefox/Iceweasel is slower under Linux than on Windows.
  • VLC, Totem, Mplayer all look like alpha version compared to Korea-made player Kmplayer. Like Foobar2000, it is the killer application under Windows.
  • aMule is not as good as eMule, which is actively updated and maintained. aMule is prone to become the victim of leech mods and its update link for server.met is outdated.
  • Notepad++ under Windows has replace Gvim as my default text editor. Gvim is powerful but its power is sealed in voluminous manuals. Do I really have to read manuals just to edit some texts?

The list goes on. All the better Windows applications I mentioned above are either free or free and Open-source. I agree that judging which application is better is subjective on some occasions, but there is one rule of thumb to tell which one is better — the one that has more functions and takes you less time to perform those functions is the better one.

Many Linux applications can do the same job as their Windows counterparts, but if they take you ten-fold of time to learn to use it or perform the task as you usually do, they are inferior applications. My experience of using Linux desktop applications is that I have to always lower my expectations of their usability and use them in a make-shift way. It might take at least five to ten years for Linux to match or surpass the usability of Windows desktop environment.

A Debian/Lenny User Experience — A Glass Half Full

As far as I could recall, I did not use Linux/Debian for about two years. Last week, I  had an open time slot and I decided to installed my favorite Distro Debian/Lenny on my aging desktop to play around a little.

My experience so far is mixed. I would say the general user experience has enhanced so much that I actually spent less time fixing the system for a better environment. On the other hand, numerous details of the Desktop environment have much to be desired, and if fixed properly, could contribute so much to the user experience, to the degree that one can term Linux Desktop as “just works”.

It all depends on the perspective a Linux user choose to view:

One can run out of his patience and feel it is a waste of time to fix many things after the initial installation. Why can’t it just work out of the box? Why does the OS often stands in the way when I try to do some work?
On the flip side, I know many Linuxers just enjoy the tweaking, tinkering, patching and fixing of their Linux. For them, the real joy of using Linux is the users’ being able to improving it the way they want it. It is a glass half full, and Linux users can end up on the extreme sides of pessimism and optimism.

For me, I’m gleefully surprised by the following user experience enhancement:

  • Once again, I get the same cool feeling running Debian box on my machine.
  • The font display is now much better than it was a couple of years ago. Now it is viewable and basically pleasant. But I don’t think I was the only one who had endured and cursed the fuzzy, eye-straining font display under Linux.
  • Xorg is configured automatically after installation, and the Nvidia 3D driver is also installed without much hassle. I could still recall the nightmare when I had to calculate modelines for my 17″ CRT monitor to get the comfortable display quality. Now that pain is only memory, and partly thanks to LCD screens.
  • The effects of Compiz 3D desktop are fantastic, and the overall experience beats the pants off Windows XP. Don’t even mention Vista to me.
  • Chinese language environment is better. With free fonts like uming and wqy, the Chinese display under Gnome is comparable to that of Windows. Not as great, but not very bad either.
  • USB disks can now be automatically loaded with its icon displayed on the desktop.
  • Splashy is such a pain remover for those who had tried grub splash. At least you don’t have to compile your kernel in order to splash, for god’s sake.
  • I can now officially suspend and hibernate my Debian box, although my machine isn’t be able to be restored to normal after the break.

But wait, Lenny is absolutely not in a position to be complacent. In fact, it invites the attack of many “haters and ranters” such as this one. In my next related post, I will bash my user experience under Lenny relentlessly.

How to fix the Segmentation Fault of Compiz under Lenny

I followed Debian Wiki’s instruction on how to install Compiz Fusion (was Beryl) under Lenny. But after walking through the tutorial, I got this error message when I tired to launch Compiz under Gnome with the command: compiz –replace

The error showed up was:

/usr/bin/compiz: line 393: 3146 Segmentation fault ${COMPIZ_BIN_PATH}${COMPIZ_NAME} $COMPIZ_OPTIONS “$@” $COMPIZ_PLUGINS

Obviously, the Debian Wiki page isn’t complete about Compiz installation. I found I had to install two extra packages in order to run Compiz under Lenny. My thanks go to the hints provided by a fellow Debianer.

apt-get install compizconfig-settings-manager compiz-fusion-plugins-extra

Only after installing these two packages, can you run Compiz under Lenny without Segmentation Fault. To enhance your Compiz experience, you may want to install two more packages: compiz-fusion-plugins-main compiz-fusion-plugins-unsupported