Monthly Archives: February 2010

Apache: password protect directories except from local ips

We faced the following problem:

1. we want to let our clients test projects on our test webserver – using basic http authentication.

2. users from our local network should not be bothered by the username and password request

The solution we implemented:

Place a .htaccess – file in the webroot of your apache webserver with the following content:

Order deny,allow
Deny from all
AuthName "htaccess password prompt"
AuthUserFile /path/to/your/webroot/.htpasswd
AuthType Basic
Require valid-user
Allow from localhost #that would be me
Allow from #suppose the ip range of your local network goes from -
Satisfy Any

Use htpasswd to create the file AuthUserFile /path/to/your/webroot/.htpasswd and create at least one user with a password:

htpasswd -c /path/to/your/webroot/.htpasswd username
#you will be promtped for a password


1.depending on your local network configuration you want might to exclude the internal router/gateway IP from the range of IPs( that do not require authentication

2.of course, the apache virtualhost must be configured in such a manner that .htacces-files are evaluated. Take a look at the AllowOverride directive

avidemux ROCKS

There are a lot of video editing/ripping/encoding, etc… tools for Linux OS.

Some of them are missing basic functions, others have extremely complicated user interfaces with tons of parameters that have to be specified even for the most simple transformation.

Avidemux has an intuitive UI, can convert/encode/export your video in nearly every possible format.

I use avidemux to convert videos recorded with my digital camera (which has little processing power and therefore does a very weak compression) to MPEG-4 ASP(Xvid) – format using a two-pass encoding which allows setting a targeted video size.

Give it a try:
sudo apt-get install avidemux

cumulative CPU time for a given process

Sometimes you want to know how much CPU time has been used by a given process – let’s say the named-daemon
Of course you can use top , but usually you would have to add columns, sort/filter by user or command name, etc…

You can simply use:
ps -A -o pid,comm,cputime | grep named

This will give you all processes that contain named in their command name(in my case one single named-process was running), showing their pid, command name, and cumulative cpu time, like:

20129 named 05:27:11