Monday, 18 April 2005

The GPL FAQ

If you have been using linux or much less, reading your daily newspaper, you might have come across the terms like Free Software Foundation, GPL and statements like "linux is GPLed". Have you ever wondered what GPL stands for ? And do you know if there is a difference between GPLed software, freeware and open source software ?

GPL stands for GNU Public Licence. It gives the end user the right to use, view, modify and share the source code of any software which has been released under this licence. And yes Linux is free because it is released under GPL. You can find answers to all these and more at the Official FSF FAQ on GNU GPL.

Sunday, 17 April 2005

Window Managers in Linux

In Linux, the concept of a GUI is different from that of Microsoft Windows OSes. While in operating systems like Windows 98/XP, the GUI is permenantly embedded in the operating system, Linux follow a different philosophy. In Linux,the act of rendering a GUI on screen follows a client - server architecture. You have got a server called XFree86 (later versions of linux ships with X.org which is the breakaway group of XFree86 due to differences in licensing issues) which listens for connections from X client applications via a network or local loopback interface.
Linux comes with a base X Window System, which includes many cutting edge XFree86 technology enhancements such as 3D hardware acceleration support, the XRender extension for anti-aliased fonts, a modular driver based design, and support for modern video hardware and input devices.
Window managers are X client programs which are either part of a desktop environment or, in some cases, standalone. Their primary purpose is to control the way graphical windows are positioned, resized, or moved. Window managers also control title bars, window focus behavior, and user-specified key and mouse button bindings.
Having said that, there are a lot of window managers for linux. So the user has the flexiblity to modify the look and feel of his GUI environment according to his tastes.
Some of the popular window managers in linux are as follows:
  • kwin — The KWin window manager is the default window manager for the KDE desktop environment. It is an efficient window manager which supports custom themes.
  • metacity — The Metacity window manager is the default window manager for the GNOME desktop environment. It is a simple and efficient window manager which supports custom themes.
  • mwm — The Motif window manager, is a basic, standalone window manager. Since it is designed to be a standalone window manager, it should not be used in conjunction with the GNOME or KDE desktop environments.
  • sawfish — The Sawfish window manager is a full featured window manager. It can be used either standalone or with a desktop environment.
  • twm — The minimalist Tab Window Manager, which provides the most basic tool set of any of the window managers and can be used either standalone or with a desktop environment. It is installed as part of X.org.
  • fluxbox - A very popular light weight window manager.
  • fvwm - Fvwm was designed to minimize memory consumption, provide a 3-D look (similar to from Motif's mwm) and provide a simple virtual desktop. Functionality can be enhanced by the use of various modules.
  • Afterstep - This is a window manager based on fvwm but designed to emulate some of the look and feel of Apple's NeXtStep interface.
  • IceWM - Another light weight window manager with a windows 98 like interface....these are just a few that come to my mind.

There are a lot more.

So what is the difference between a window manager and a desktop ?
The difference is that Desktop environments have advanced features which allow X clients and other running processes to communicate with one another and allow all applications written to work in that environment to perform advanced tasks, such as drag and drop operations; Cut, copy and paste data between different applications to name a few and, they supply their own range of integrated utilities and applications. This convenience and ease of use makes them particularly attractive to new users, which has made them very popular. A Desktop environment displays a more polished front to the user. Some of the more popular desktop enviroments are Gnome, Kde, XFce and cde.
You can also run the window managers as standalone. For example, try running twm window manager as follows from the command line:

# startx -e

To start twm, try:

# startx -e twm

This will give you a fair idea about the differences between window managers and desktop environments.

$100 Laptops running Linux

Yes!! you heard me right. This is a project brought out by MIT Media Labs to introduce advanced computing to the masses. More specifically the various schools in the developing world where the students cannot afford to buy computers. The laptop will have 12" colour screen which will show the images using "electronic ink" - a technology developed at MIT Media Labs and it will be loaded with - what else - Linux OS. The other configuration parameters are 1GB HDD, 500Mhz processor, lots of USB ports, WiFi enabled and will use innovative power including wind-up and it will cost just $100. The project is still in the design stage and is expected to be out by end of 2006.
What makes it really interesting is that, the project is sponsored by a host of reputed companies including Google, AMD and News Corp amoung others.But there is a catch though - It will not be available to individuals for purchase; but only to government agencies which are willing to adopt a policy of one laptop per child. Good for the kids and good for linux. You can read all about the project at the MIT Media Labs Website.
Check out these photos:

Figure : You can use this laptop in three different ways.

Figure : Looks Cool. Uses revolutionary technology.


Updates :

Thursday, 14 April 2005

A collection of PDF viewers for GNU/Linux

Portable Document Format (pdf) file is a self-contained cross-platform document. In plain language, it is a file that will look the same on the screen and in print, regardless of what kind of computer or printer someone is using and regardless of what software package was originally used to create it.Although they contain the complete formatting of the original document, including fonts and images, PDF files are highly compressed, allowing complex information to be downloaded efficiently.
PDF is a file type created by Adobe Systems Incorporated. You need a viewer to read the pdf files.And since Adobe released the schema of PDF and postscript (another file format for printing purposes) in the public domain, anybody interested in creating a software for viewing PDF files can easily create one.
Linux being a community effort,there are a number of utilities for viewing PDF files.
The one that come installed by default on most modern linux distributions is GPDF . GPdf is a PDF viewer for the GNOME 2 platform. It has got basic PDF viewing capabilities but not many features . Another PDF viewer is XPDF . Xpdf is not so beautiful to look at. But it has a very functional interface with which you can view the PDF files. An advantage of XPDF over GPDF is that it has got a low memory footprint and so loads very fast even on my machine which has only 64 MB RAM.
Recently Gnome has brought out another document viewer called Evince . Evince is a document viewer for multiple document formats like pdf, postscript and support planned for other formats like multi-page TIFF, DJVU, DVI and Images. Their plan is to replace the multiple document viewers that exist on the GNOME Desktop with a single simple application.
Other PDF viewers that come to mind are ggv (Ghostscript Viewer) and kpdf (pdf viewer on kde). In fact true to the spirit of freedom of choice, there are a plethora of pdf viewers for the GNU/Linux platform and the user can choose to use the one he is more comfortable with.
Till recently Adobe had not released a version of Acrobat Reader (a popular software used to view PDF files) for GNU/Linux. But that has changed now. They have released the Acrobat Reader Version 7.0 for linux (over 30 MB download), which is a very important milestone for the GNU/Linux community because even though Adobe has released only a binary version of their Acrobat Reader, the mere act of releasing a software on this platform strengthens the fact that GNU/Linux on the desktop has come of age and is becoming increasingly popular among the masses. And companies that have a stake in the IT industry cannot afford to sit back and all together ignore this platform.

Saturday, 9 April 2005

Installing linux on a Mac Mini

I have always been fascinated by the iMacs from Apple after I got to use an iMac at a friends place. But buying one was beyond my price range until Apple released the Mac Mini - widely touted as the budget Mac which could make the PC run for their money.

For people who doesn't know - Apple brings out the Mac series of machines running their own proprietary OS called OSX. This Operating system is built on a Unix base (more specifically the FreeBSD) and so can run most command line tools of Unix/Linux. Also unlike the PC which is built on Intel architecture, the Mac computers use the G5 Chipset (PowerPC Architecture). Frankly speaking, each Mac computer could be considered to be a piece of art considering the elegant look and latest technologies used in them.

Now my writing about this in the blog dedicated to linux takes significance because I have always wondered if Linux could be installed on a Mac computer. Recently, I came across this article which gives a detailed explanation on Installing Debian Linux on the Mac Mini. Those of you who are thinking of buying a Mac Mini might be interested to know that you can also dual boot between Linux and OSX in the Mac Mini just like you do in a PC.

Tuesday, 5 April 2005

Configuring Apache webserver to restrict access to your website

Apache Webserver is the most popular web server and has a market share of around 60%. Here I will explain a small but very useful feature of the apache web server - which is restricting access to (a part of) your website to only the privileged few by implementing username and passwords.
There are two ways of restricting access to documents.
  1. Either by the hostname of the browser being used
  2. By asking a username and password
The first method can be used to, for example, restricting documents being used within a company. But if the people who are accessing documents are widely dispersed, then the second method is more suitable.
Here I will explain the second method - ie, assigning username and passwords to users who are authorized to access the documents. This is known as user authentication.
Setting up user authentication takes two steps :
  1. Create a file containing username and passwords - Apache webserver has a utility called htpasswd to create the file containing username and passwords. Here I am creating a file called 'users' in the /usr/local/etc/ directory.
Note: For security reasons, the above file should NOT be under the document root. It can be anywhere BUT the document root.
The first time you run the htpasswd utility, you run it using the -c flag as follows:
# htpasswd -c /usr/local/etc/users gopinath
The -c argument tells htpasswd to create a new users file. When you run the above command, you will be prompted to enter a password for the user gopinath, and confirm it by entering it again. Other users can be added to the existing file in the same way, except that the -c argument is not needed. The same command can also be used to modify the password of an existing user.
After adding a few users, the /usr/local/etc/users file might look like this :
gopinath:WrU90BHQai36
kumar:iABSd12QWs67
ankit:Wer56HsD12s6
The first field is the username and the second field is the encrypted password.
Now comes the Apache server's configuration part. Open the apache server's configuration file /etc/httpd/conf/httpd.conf (your configuration file will be in different location depending on the distribution you are using) and look for the line :
AllowOverride None 
And change it to
AllowOverride AuthConfig
If you want to protect the document root itself, create a file '.htaccess' in the top directory path and include the following lines to it:
#File: .htaccess
AuthName "Only Valid Access"
AuthType Basic
AuthUserFile /usr/local/etc/users
require valid-user
AuthName - directive specifies a realm name for this protection. Once a user has entered a valid username and password, any other resource within the same realm name can be accessed with the same username and password.
AuthType - directive tells the server what protocol is to be used for authentication. At the moment, 'Basic' is the only method available. However, a new method, 'Digest' is about to be standardized, and once browsers start to implement it, Digest authentication will provide more security than Basic authentication.
AuthUserFile - tells the server the location of the user file created by htpasswd utility. A similar directive, AuthGroupFile, can be used to tell the server the location of a group's file.

Lastly don't forget to restart the web server which rereads the changed configuration files :
# service httpd restart
From here on when you try to access your protected site or the directory via the web browser, you will be asked for authentication first. And only those users whose name has been entered in the file pointed to by the AuthUserFile directive will be allowed access to your site.

Thursday, 3 February 2005

Mounting a filesystem automatically using 'autofs'

There was a drawback in Linux when compared to other OSes in that, you cannot read the contents of a filesystem as easily as you do in other OSes like Windows without executing the mount commands (this is especially true for removable media like a Floppy, CDROM or remote filesystems like an NFS share). For example, if you want to read the contents of a floppy, you have to mount the floppy into a directory using the mount command. And after you have read the data , and before you pull out the floppy from the floppy drive, you have to remember to unmount the floppy using umount command. If by any chance, you have forgotten to unmount the floppy, there is a good chance that your data will be corrupted.
But now you have an easy way out of the hassle of mounting and unmounting your filesystem and using it like you use in windows. This is achieved by the autofs daemon.
Autofs is a standard feature in all major linux distributions. It is installed by default. Here I will explain how to configure autofs in RedHat distribution. The configuration is the same in other distributions other than the chkconfig and service scripts which are a RedHat feature.
First check if the autofs daemon is configured to start at boot time by running the command:
# chkconfig autofs --list
autofs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
As you can see from the above listing that autofs is OFF on my system. So I turn it ON using the command:
# chkconfig autofs on
# chkconfig autofs --list
autofs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Now the autofs daemon is configured to start automatically when you boot up your machine.
The main configuration files for autofs is /etc/auto.master. This file has the syntax as follows:
Each mount point is given on a seperate line. For eg:
# File: /etc/auto.master
/mnt /etc/auto.misc
Where, /mnt is the mount point and it points to another file called autofs.misc (the file can have any name but following precedence, it should start with the name auto), which contains the details of how and what to mount.Suppose I have to make autofs automount my floppy whenever I change into my /mnt/floppy directory, and unmount it automatically when I come out of the /mnt/floppy directory, I just include the following line into my /etc/auto.misc file.
# File: /etc/auto.misc
floppy -fstype=auto,rw,users :/dev/fd0
Each line in the file is divided into 3 sections seperated by one or more spaces.They are :
  • A key - The key can be any single word but preferably the name of the device or the name of the sub-directory below the mount point specified in the auto.master file.
  • The mount options for the filesystem associated with the key. In the listing of my auto.misc file, I have set it to mount with read/write permission and autodetect the type of filesystem - whether ext3 or vfat etc - and who all can mount the filesystem (see man mount for more options).
  • The path of the device file associated with the filesystem. It should be preceeded by a colon (:).
Now I save and exit the /etc/auto.misc file. The last thing to do is to restart the autofs daemon to re-read the /etc/auto.master file.
# service autofs restart
Note: Each time any changes are made to the /etc/auto.master file, you have to restart the autofs daemon to bring the changes to effect. But you need not restart autofs if you change the contents of auto.misc file or the contents of any other files listed in the /etc/auto.master file. Now I test my setup by inserting a floppy into the floppy drive and execute the following command:
# cd /mnt/floppy
Success!! The floppy gets mounted automatically and I am able to list the contents of the floppy.Now I come out of the directory. And after a period of inactivity (default is 60 sec), the floppy is automatically unmounted.
You can likewise set the remote NFS share (at IP address 192.168.0.1) to mount using autofs. For example, I could append a line in /etc/auto.misc file as follows:
# File: /etc/auto.misc
nfsshare -fstype=auto,soft,intr 192.168.0.1:/remote_nfs_share
cdrom -fstype=iso9660,ro :/dev/cdrom
.. and so on.