Custom Search

Thursday, May 15, 2008

Device drivers for hardware devices

Device drivers is one of the imortant and necessary thing required for Hardware devices . Every operating system, including the Linux kernel, comes with a lot of them.
When you configure a kernel, the menu from which you must choose which devices you have in your computer is actually a list of device drivers available to you. You can configure your kernel by using the following:
cd /usr/src/linux
make menuconfig
All existing hardware can not be supported by Linux. Like other operating systems it is still not that popular
If you have a device that is not in the list, then you will need to search for it on the Web. Some drivers may exist for Linux and not be in the default kernel. But if a device is not currently supported by any driver for Linux, then you will have to wait for someone to make one, or make one yourself.

No device found eventhough LPD is started

LPD is the printer daemon. Its initiation takes place at boot time and gets started during booting of the system. Assume that a printer is connected to the printer port. But a problem may occur when the daemon is started and no device is found.
A configuration problem in the kernel can be considered as one of the most common cause for this problem . Make sure that parallel port, PC-style parallel port, and printer support is enabled in the configuration, and that modules are loaded.

How to control the blinking of keyboard leds.

Nothing irritates you more than blinking keyboard leds while you are working on your computer. They generally intimates you about your num lock or caps Lock key, if ON. Keyboard leds can definitely be used for other meaningful purposes also.
The keyboard leds can be controlled by a device driver called the misc driver. That driver can control all kinds of misc things. You could write your own driver to make them blink or light up at any system event.
A program called tleds is available from http://www.hut.fi/~jlohikos/tleds.html. That program will have them blink based on network usage. This will lead to blinking of one LED for incoming packet and one for outgoing packet.

Find hardware information

When the Linux system boots, it will try to detect the hardware installed in the computer. It will then make a fake file system called procfs and will store important information about your system in it.
You can get information about your system simply by browsing the directory /proc. The files in there will contain information such as the processor you have, the amount of memory and the file systems the kernel currently supports.

Added processors

Dual processors are becoming more and more popular in computers. Of course, you won't be able to see much performance increase in Linux unless you tell Linux about the second CPU. Here is how to do it.
Go in the kernel, and enable SMP. SMP means Symetric Multi-Processing and tells the kernel that more than one processor can be used.
After a reboot, Linux should tell you that it has detected 2 processors and what their status are.

Detecting 2 ethernet cards

To configure an ethernet card in Linux, you need to enable it in the kernel. Then the kernel will detect your ethernet card if it is at a common IO port. But it will stop there, and will never check if you have 2 ethernet cards.
The trick is to tell the ethernet driver that there are 2 cards in the system. The following line will tell the kernel that there is an ethernet card at IRQ 9 and IO 0x300, and another one at IRQ 10 and IO 0x340:
ether=9,0x300,eth0 ether=10,0x340,eth1
That line can be added up in the /etc/lilo.conf file or at the "boot:" prompt on bootup . YOu also need to run the following command:
lilo
That will reload the lilo.conf file and enable changes.

Wednesday, May 14, 2008

FTP access restrictions

When you first install Linux, it comes with a lot of Internet services running, including mail, telnet, finger and FTP. You really should disable all those that you don't need from /etc/inetd.conf and your startup scripts.
FTP may be very useful, but must be configured correctly. It can allow people to log into their accounts, it can allow anonymous users to login to a public software directory, and it can display nice messages to them.
The files that you will probably want to modify are /etc/ftpusers and /etc/ftpaccess.
The file /etc/ftpusers is very simple. It lists the people that will not be allowed to use FTP to your system. The root account, and other system accounts should be in that file.
The file /etc/ftpaccess is a bit more complex and controls the behaviour of the FTP server. It tells it what to use as README file to display on a directory listing, what kind of logs to create and what messages to display.
Note that if you create an anonymous FTP area, you will need to read the FTP man page and do exactly what it tells you to avoid possible security risks.

Linux and NT booting

Some people choose to have both Windows NT and Linux on the same system. Windows NT has its own boot loader called NTLDR and Linux has LILO. Which should go on the MBR?
The safest way is to install Windows NT first, and give it the MBR. Then, when you install Linux, tell LILO to install on the Linux partition. Also set the Linux partition as the active partition. When the system boots, LILO will be loaded, and if you want to boot Windows NT, then LILO can load the MBR with NTLDR in it.
There is a mini HOWTO text covering this subject available at
http://metalab.unc.edu/pub/Linux/docs/HOWTO.

Multiple kernels choices

When you compile a new kernel, you will often change your configuration. This means you may forget to include an important driver, like the IDE driver, or otherwise make your system unbootable. The solution is to always keep your old kernel.
When you compile your kernel, the compilation procedure will often copy your old kernel into vmlinuz.old.
If it does not, you can do it manually. What you should do is add an entry to /etc/lilo.conf allowing you to boot your old kernel. You should view the lilo man page for the complete syntax. You could also add entries for different kernels, for example if you want to have an older stable version of the kernel and the newest development version on your system.
Note that some distributions name their kernel with the version they represent. For example, your current kernel may be /boot/vmlinuz-2.0.36-0.7

Default file permissions

When you create a file, the system gives it default permissions. On most systems the permissions are 755 (read, write and execute for the owner, and read and execute for others).
This default is setup with the umask command. To use the command, you need to find the right octal number to give it. The permissions in the umask are turned off from 666. This means that a umask of 022 will give you the default of 755. To change your default permissions from 755 to 700, you would use this command:
umask 077

How to change the Linux boot mode.

When a Linux system boots, it loads the kernel, all its drivers, and the networking servers, then the system will display a text login prompt. There, users can enter their user names and their passwords. But it doesn't have to boot this way.

There are 3 modes defined in most Linux distributions that can be used for booting. They are defined in /etc/inittab and have specific numbers. The first mode, also called runlevel 1, is single user mode. That mode will only boot the system for 1 user, with no networking. Runlevel 3 is the default mode. It will load the networking servers and display a text login prompt. Runlevel 5 is the graphical mode. If you have X Window installed and configured, you can use it to display a graphical login prompt.

The way to change this is to edit /etc/inittab and change the initdefault line:
id:3:initdefault:

Changing a 3 to a 5 will make the system display a xdm graphical screen on bootup.

The Process Status command: ps

ps command is used to display the process attributes. The command reads through the kernel's data structures and process tables to fetch the characterstics of processes. e.g. if you execute the command immediately after logging in you will see the following:

$ ps
PID TTY TIME CMD
291 console 0:00 bash

Inorder to get a detailed listing showing the parent of every process you can use the -f (full) option:

$ ps -f
UID PID PPID C STIME TTY TIME CMD
sam 257 191 0 10:25:12 console 0:00 vi create_user.sh
sam 191 1 0 08:22:23 console 0:00 -bash
sam 268 267 0 10:25:16 console 0:00 /user/bin/bash -i

As you can see the parent (PPID) and the owner (UID) of every process. The login shell (PID 191) has the PPID 1, the second process of the system. The first process is always init having PID 0.