<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-985872163295741762</id><updated>2012-01-17T09:14:18.247+05:30</updated><title type='text'>Art of Linux</title><subtitle type='html'>All I need is to be free</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-8982603885526664812</id><published>2009-08-15T20:31:00.001+05:30</published><updated>2009-08-15T20:31:53.355+05:30</updated><title type='text'>Welcome to my blog!!!</title><content type='html'>&lt;span style="font-size: 100%;"&gt;Warm welcome to all linux newbies.. You will find a lot of interesting stuffs here which you can understand easily. Experienced guys please excuse..This is just a beginners guide....:)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-8982603885526664812?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/8982603885526664812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=8982603885526664812' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8982603885526664812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8982603885526664812'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2009/08/welcome-to-my-blog.html' title='Welcome to my blog!!!'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-7491051586461104382</id><published>2009-08-15T20:27:00.004+05:30</published><updated>2009-08-15T20:37:36.621+05:30</updated><title type='text'>Cron jobs tutorial for beginners</title><content type='html'>&lt;div style="text-align: justify;"&gt;Cron is a utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs. Crontab (CRON TABle) is a file which contains the schedule of cron entries to be executed at specified times.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;commands:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;crontab filename        Install filename as your crontab file.&lt;br /&gt;crontab -e --&gt;                      Edit your crontab file.&lt;br /&gt;crontab -l                       --&gt; Show your crontab file.&lt;br /&gt;crontab -r --&gt; Remove your crontab file.&lt;br /&gt;crontab -v              --&gt; Display the last time you edited your crontab file&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Inorder to setup a cron you just need to specify the task and the time at which it should be executed. Definitely it should be in the format as below. It can be a little tough at the beginning, but will be much easier if you learn how to specify the time at which a particular task should be executed. Workout with examples to get more idea about cron jobs.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Crontab syntax :-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;A crontab file has five fields for specifying day , date and time  followed by the command to be run at that interval.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;*     *   *   *    *  command to be executed&lt;br /&gt;-     -    -    -    -&lt;br /&gt;|     |     |     |     |&lt;br /&gt;|     |     |     |     +----- day of week (0 - 6) (Sunday=0)&lt;br /&gt;|     |     |     +------- month (1 - 12)&lt;br /&gt;|     |     +--------- day of month (1 - 31)&lt;br /&gt;|     +----------- hour (0 - 23)&lt;br /&gt;+------------- min (0 - 59)&lt;br /&gt;&lt;br /&gt;ie,&lt;br /&gt;minute hour  day month day-of-week command-line-to-execute&lt;br /&gt;0-59   0-23 1-31 1-12   0-7&lt;br /&gt;&lt;br /&gt;In a linux server you can find cron entry for a user at /var/spool/cron/username&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;examples:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;if you want a certain command to run at 5.30 am, you will have to code it as:&lt;br /&gt;30 5 * * * command to execute&lt;br /&gt;&lt;br /&gt;If you want something run at 8 pm everyday, it has to be coded as:&lt;br /&gt;0 20 * * * command to execute (20 is 8 pm in the 24-hour time format)&lt;br /&gt;&lt;br /&gt;If you want to set the cron job every sunday at midnight 11.30 PM&lt;br /&gt;30 23 * * 0 command to execute (0--represents the Sunday)&lt;br /&gt;&lt;br /&gt;If you want to run the task at 1am and 2am only from Monday to Friday:&lt;br /&gt;* 1,2 * * 1-5 command to execute&lt;br /&gt;&lt;br /&gt;If you want to execute a cronjob at 4 am every Sunday:&lt;br /&gt;00 4 * * 0 command to execute&lt;br /&gt;&lt;br /&gt;To execute a cronjob at 4:42 am every 1st of the month&lt;br /&gt;42 4 1 * * command to execute&lt;br /&gt;&lt;br /&gt;Cron also supports &lt;span style="font-weight: bold;"&gt;'step'&lt;/span&gt; values.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;A value of */2 in the date of month field means that the command runs every two days and */5 in the hours field would mean the command runs every 5 hours.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Difference between */5 * * * * and 5 * * * *&lt;br /&gt;&lt;br /&gt;*/5 * * * * command to execute  --&gt;&gt; This will execute the cronjob in every 5&lt;br /&gt;minutes.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;5 * * * * command to execute  --&gt;&gt; This will execute cron job in 5th minute of every hour&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;If both the day of month and day of week are specified, the command will be executed when either of the events happen.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;* 12 16 * 1 command to execute --&gt;&gt; command will be executed on every Monday and every 16th&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Cron also accepts &lt;span style="font-weight: bold;"&gt;lists&lt;/span&gt; in the fields. Lists can be in the form, 1,2,3 (meaning 1 and 2 and 3) or 1-3 (also meaning 1 and 2 and 3)&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;59 11 * * 1,2,3,4,5 command to execute --&gt;&gt; will execute the command at 11:59 Monday, Tuesday, Wednesday, Thursday and Friday&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;to be continued...&lt;br /&gt;&lt;br /&gt;ref:&lt;br /&gt;http://www.unixgeeks.org/security/newbie/unix/cron-1.html&lt;br /&gt;http://en.wikipedia.org/wiki/Cron&lt;br /&gt;http://www.aota.net/Script_Installation_Tips/cronhelp.php3&lt;br /&gt;http://www.thesitewizard.com/general/set-cron-job.shtml&lt;br /&gt;https://www.simplehelix.com/hosting/knowledgebase.php?action=displayarticle&amp;amp;catid=4&amp;amp;id=77&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-7491051586461104382?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/7491051586461104382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=7491051586461104382' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7491051586461104382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7491051586461104382'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2009/08/cron-jobs-tutorial-for-beginners.html' title='Cron jobs tutorial for beginners'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-8270675569989669972</id><published>2009-05-04T10:50:00.001+05:30</published><updated>2009-05-04T10:50:34.746+05:30</updated><title type='text'>Linux Boot Process</title><content type='html'>&lt;div style="text-align: justify;"&gt;There process of booting a linux system consists of various stages. The boot process is same in almost all the linux variants. I have tried my level best to explain it in a simple way, so that a beginner can understand the process easily.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Here we go...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When a system is switched on the processor looks at the end of    system memory for the &lt;i class="FIRSTTERM"&gt;Basic Input/Output System&lt;/i&gt;    or &lt;i class="FIRSTTERM"&gt;BIOS&lt;/i&gt; program and runs it. The BIOS is made up of two parts: the POST code and runtime services. POST(Power On Self Test) checks the system hardware and performs local device initialization. Then BIOS runtime services check for a valid boot device. If no configuration changes are made in BIOS it will first check floppy drive then harddisk drive and then on removable disk drives if any. If no boot device is found it will sends an interrupt and boot process will be terminated.&lt;br /&gt;&lt;br /&gt;The boot device contains primary bootloader in the first 512-byte sector of the disk. This segment is called the Boot Sector. Sometimes it is also called Master Boot Record(MBR). Once a valid boot device is found, primary bootloader is loaded into RAM and BIOS passes control to it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Stage 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The primary boot loader that resides in the MBR is a 512-byte image containing both program code and a small partition table. The first 446 bytes are the primary boot loader, which contains both executable code and error message text. The next sixty-four bytes are the partition table, which contains a record for each of four partitions (sixteen bytes each). The MBR ends with two bytes that are defined as the magic number (0xAA55). The magic number serves as a validation check of the MBR.&lt;br /&gt;&lt;br /&gt;The job of the primary boot loader is to find and load the secondary boot loader (stage 2) by looking through the partition table for an active partition. When it finds an active partition, it scans the remaining partitions in the table to ensure that they're all inactive. When this is verified, the active partition's boot record (secondary boot loader) is read from the device into RAM and executed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Stage 2 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The secondary boot loader is also called the kernel loader. The task at this stage is to load the Linux kernel and optional initial RAM disk.&lt;br /&gt;&lt;br /&gt;The second stage boot loader has two functions:&lt;br /&gt;&lt;br /&gt;1. Display the list of available kernels upon request, defined in bootloader configuration file.&lt;br /&gt;(ie, for LILO /etc/lilo.conf and for Grub /etc/grub.conf)&lt;br /&gt;&lt;br /&gt;2. Consult with filesystem to load the default kernel image and initrd image into memory.&lt;br /&gt;&lt;br /&gt;With the images ready, the stage 2 boot loader passes the control to kernel image.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;Stage 3 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From here the Kernel stage begins.&lt;br /&gt;&lt;br /&gt;The kernel image is a compressed image typically a zImage or bzImage.&lt;br /&gt;&lt;br /&gt;The bzImage is decompressed by the C function decompress_kernel (located in ./arch/i386/boot/compressed/misc.c). When the kernel is decompressed into memory, it immediately initializes and configures memory paging and configures the various hardware attached to the system, including all processors, I/O subsystems, and storage devices.&lt;br /&gt;&lt;br /&gt;Then it loads the initial RAM disk(initrd) and loads all the necessary drivers. This initrd serves as a temporary root file system in RAM and allows the kernel to fully boot without having to mount any physical disks. At this point, there are no user applications that allow meaningful input to the system, not much can be done with the system. To set up the user environment, the kernel executes the /sbin/init program.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Init&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After the kernel is booted and initialized, the kernel starts the first user-space application. The /sbin/init program (also called init) coordinates the rest of the boot process and configures the environment for the user.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;  &lt;span style="font-weight: bold;"&gt;"&lt;/span&gt;I&lt;span style="font-style: italic;"&gt; will not say I failed 1000 times, I will say that I discovered there are 1000 ways that can cause failure&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;"&lt;/span&gt;   -- &lt;span style="font-weight: bold;"&gt;Thomas Edison&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;ref:&lt;br /&gt;&lt;a href="http://www.ibm.com/developerworks/linux/library/l-linuxboot/"&gt;http://www.ibm.com/developerworks/linux/library/l-linuxboot/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.linuxtopia.org/online_books/centos_linux_guides/centos_linux_reference_guide/s1-boot-init-shutdown-process.html"&gt;http://www.linuxtopia.org/online_books/centos_linux_guides/centos_linux_reference_guide/s1-boot-init-shutdown-process.html    &lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-8270675569989669972?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/8270675569989669972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=8270675569989669972' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8270675569989669972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8270675569989669972'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2009/05/linux-boot-process.html' title='Linux Boot Process'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-2729654763735419434</id><published>2008-10-30T21:55:00.032+05:30</published><updated>2009-08-15T20:24:53.298+05:30</updated><title type='text'>testing page</title><content type='html'>&lt;span style="font-size:130%;"&gt;testing page&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-2729654763735419434?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/2729654763735419434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=2729654763735419434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/2729654763735419434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/2729654763735419434'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/10/boot-process.html' title='testing page'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-7867295771306010698</id><published>2008-09-30T12:20:00.006+05:30</published><updated>2008-11-24T11:45:55.313+05:30</updated><title type='text'>Contents of /etc/fstab</title><content type='html'>&lt;span style="font-weight: bold;"&gt;fstab&lt;/span&gt;&lt;br /&gt;*****&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;fstab is a configuration file that contains information of all the partitions and storage devices in your computer. The full path to this file is /etc/fstab.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;/etc/fstab contains information of where your partitions and storage devices should be mounted and how. If you can't access your Windows partition from Linux, aren't able to mount your CD or write to your floppy as a normal user, or have problems with your CD-RW, you probably have a misconfigured /etc/fstab file. So, you can usually fix your mounting problems by editing your fstab file.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;/etc/fstab is just a plain text file, you must have the root privileges before editing fstab. So, in order to edit the file, you must either log in as root or use the su command to become root.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Overview of the file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Contents of /etc/fstab will be different on different systems. But the basic structure of fstab is always the same. Here's an example of the contents of /etc/fstab:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;/dev/hda2       /                   ext2     defaults    1       1&lt;br /&gt;&lt;/div&gt;/dev/hdb1           /home        ext2          defaults       1      2&lt;br /&gt;/dev/cdrom     /media/cdrom     auto     ro,noauto,user,exec     0 0&lt;br /&gt;/dev/fd0     /media/floppy     auto     rw,noauto,user,sync     0 0&lt;br /&gt;proc     /proc     proc     defaults     0 0&lt;br /&gt;/dev/hda1     swap     swap     pri=42     0 0&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Every line (or row) contains the information of one device or partition. The first column contains the device name, the second one its mount point, third its filesystem type, fourth the mount options, fifth (a number) dump options, and sixth (another number) filesystem check options. Let's take a closer look at this stuff.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1st and 2nd columns: Device and default mount point&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The first and second columns should be pretty straightforward. They tell the mount command exactly the same things that you tell mount when you mount stuff manually: the device or partition, and the mount point. The mount point specified for a device in /etc/fstab is its default mount point. That is the directory where the device will be mounted if you don't specify any other mount point when mounting the device.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;For &lt;span style="font-weight: bold;"&gt;example&lt;/span&gt; the default mount point of floppy disk drive is /media/floppy. ie, executing the following command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;mount /dev/fd0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;will mount floppy drive into /media/floppy, because that's the default mount point specified in&lt;br /&gt;&lt;/div&gt;/etc/fstab. If there is no entry for /dev/fd0 in my fstab when I issue the command above, mount gets very confused because it doesn't know where to mount the floppy.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;You can freely change the default mount points listed in /etc/fstab, just make sure the mount point is a directory that already exists on your system. If it doesn't, simply create it.&lt;br /&gt;&lt;br /&gt;Some partitions and devices are also automatically mounted when your Linux system boots up. For example, have a look at the example fstab above. There are lines that look like this:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;/dev/hda2 / ext2 defaults 1 1&lt;br /&gt;/dev/hdb1 /home ext2 defaults 1 2&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;these lines mean that /dev/hda2 will be mounted to / and /dev/hdb1 to /home. This is done automatically when your Linux system boots up...&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3rd column: Filesystem type&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The third column in /etc/fstab specifies the filesystem type of the device or partition. Some of the most common filesystem types are explained below:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;ext2 and ext3&lt;/span&gt; : Very likely your Linux partitions are Ext3. Ext2 used to be the standard filesystem for Linux, but these days, Ext3 and ReiserFS are usually the default filesystems for almost every new Linux distro. Ext3 is a newer filesystem type that differs from Ext2 in that it's journaled, meaning that if you turn the computer off without properly shutting down, you shouldn't lose any data and your system shouldn't spend ages doing filesystem checks the next time you boot up.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;reiserfs&lt;/span&gt; : Your Linux partitions may very well be formatted as ReiserFS. Like Ext3, ReiserFS is a journaled filesystem, but it's much more advanced than Ext3. Many Linux distros (including SuSE) have started using ReiserFS as their default filesystem for Linux partitions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;swap&lt;/span&gt; : The filesystem type "swap" is used in your swap partitions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;vfat and ntfs&lt;/span&gt; : Windows partitions are probably either Vfat or NTFS. The 9x series (95, 98, ME) all use Vfat (more widely known as FAT32), and the NT series (NT, 2000, XP) use NTFS. 2000 and XP partitions may be formatted as Vfat, too. If you want to be able to write to your Windows partitions from Linux, I suggest formatting them as Vfat, because Linux's support for writing to NTFS partitions is a bit shabby at this moment.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;auto No, this isn't a filesystem type :-) The option "auto" simply means that the filesystem type is detected automatically.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4th column: Mount options&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The fourth column in fstab lists all the mount options for the device or partition. This is also the most confusing column in the fstab file. There are many options available, but some of the most widely used ones are as follows :&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;auto and noauto&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;With the auto option, the device will be mounted automatically at bootup. If you take a look at the example fstab above, you'll see that the floppy and CD-ROM both have "auto" as their filesystem type, because their filesystem type may vary. One floppy might be formatted for Windows and the other for Linux's Ext2. That's why it's wise to let the system automatically detect the filesystem type of media such as floppies and cdroms. auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;user and nouser&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;These are very useful options. The user option allows normal users to mount the device, whereas nouser lets only the root to mount the device. nouser is the default, which is a major cause of headache for new Linux users. If you're not able to mount your cdrom, floppy, Windows partition, or something else as a normal user, add the user option into /etc/fstab.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;exec and noexec&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition. exec is the default option, which is a good thing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;ro&lt;/span&gt;&lt;br /&gt;Mount the filesystem read-only.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;rw&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Mount the filesystem read-write. Again, using this option might cure the headache of many new Linux users who are tearing their hair off because they can't write to their floppies, Windows partitions, or something else.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;sync and async&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;How the input and output to the filesystem should be done. sync means it's done synchronously. If you look at the example fstab, you'll notice that this is the option used with the floppy. In plain English, this means that when you, for example, copy a file to the floppy, the changes are physically written to the floppy at the same time you issue the copy command.&lt;br /&gt;&lt;br /&gt;However, if you have the async option in /etc/fstab, input and output is done asynchronously. Now when you copy a file to the floppy, the changes may be physically written to it long time after issuing the command. This isn't bad, and may sometimes be favorable, but can cause some nasty accidents: if you just remove the floppy without unmounting it first, the copied file may not physically exist on the floppy yet!&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;async is the default. However, it may be wise to use sync with the floppy, especially if you're used to the way it's done in Windows and have a tendency to remove floppies before unmounting them first.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;defaults&lt;/span&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;Uses the default options that are rw, suid, dev, exec, auto, nouser, and async.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5th and 6th columns: Dump and fsck options&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;dump is a backup utility and fsck is a filesystem check utility.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The 5th column in /etc/fstab is the dump option. Dump checks it and uses the number to decide if a filesystem should be backed up. If it's zero, dump will ignore that filesystem. If you take a look at the example fstab, you'll notice that the 5th column is zero in most cases.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The 6th column is a fsck option. fsck looks at the number in the 6th column to determine in which order the filesystems should be checked. If it's zero, fsck won't check the filesystem.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;That's it....&lt;br /&gt;ref: &lt;a href="http://www.tuxfiles.org/linuxhelp/fstab.html"&gt;http://www.tuxfiles.org/linuxhelp/fstab.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-7867295771306010698?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/7867295771306010698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=7867295771306010698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7867295771306010698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7867295771306010698'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/09/contents-of-etcfstab.html' title='Contents of /etc/fstab'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-8374525866361650053</id><published>2008-08-18T11:20:00.004+05:30</published><updated>2008-08-20T12:07:01.898+05:30</updated><title type='text'>Compress/Uncompress Gzip, Zip, and Tar files</title><content type='html'>&lt;span style="font-weight: bold;"&gt;File Compression and Archiving&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;.bz2 — a file compressed with bzip2&lt;/span&gt;&lt;br /&gt;---------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt; bzip2 and bunzip2 are file compression and decompression utilities. The bzip2 and bunzip2 utilities are newer than gzip and gunzip and are not as common yet, but they are rapidly gaining popularity. The bzip2 utility is capable of greater compression ratios than gzip. Therefore, a bzip2 file can be 10-20% smaller than a gzip version of the same file. Usually, files that have been compressed by bzip2 will have a .bz2 extension.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To compress a file using bzip2, execute the following command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;bzip2 filename.txt&lt;/span&gt; (where filename.txt is the name of the file you wish to compress)&lt;br /&gt;&lt;br /&gt;To uncompress a bzip2 file, execute the following command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;bunzip2 filename.txt.bz2&lt;/span&gt; (where filename.txt.bz2 is the name of the file you wish to uncompress)&lt;br /&gt;&lt;br /&gt;The decompressed file from that of the compressed file as follows:&lt;br /&gt;&lt;br /&gt;             filename.bz2------becomes--filename&lt;br /&gt;             filename.bz -------becomes--filename&lt;br /&gt;             filename.tbz2  ---- becomes--filename.tar&lt;br /&gt;             filename.tbz    ------becomes--filename.tar&lt;br /&gt;             anyothername   --- becomes--anyothername.out&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;.gz — a file compressed with gzip&lt;/span&gt;&lt;br /&gt;------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt; gzip and gunzip are GNU file compression and decompression utilities. Usually, files that have been compressed by gzip will have a .gz extension. However, sometimes you may see a file that has a .tgz extension. This is a TAR file that has been compressed by gzip. The .tgz extension is a shorthand version for the .tar.gz extension. This type of file must be uncompressed with gunzip before it can be untarred.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To compress a file using gzip, execute the following command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;gzip filename.txt &lt;/span&gt;(where filename.txt is the name of the file you wish to compress)&lt;br /&gt;&lt;br /&gt;To uncompress a gzip file, execute the following command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;gunzip filename.txt.gz&lt;/span&gt; (where filename.txt.gz is the name of the file you wish to uncompress)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;.tar.gz/.tgz/.tar.Z — a file compressed with Tar (Tape ARchive)&lt;/span&gt;&lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;A file packaging tool included with UNIX/Linux for the purpose of assembling a collection of files into one combined file for easier archiving. It was originally designed for tape backup, but today can be used with other storage media. When run by itself, it produces files with a .tar extension. When combined with Gzip, for data compression, the resulting file extensions may be .tgz, .tar.gz or .tar.Z.&lt;br /&gt;&lt;br /&gt;To compress a directory using tar, execute the following command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;tar cvzf filename.tgz foldername&lt;/span&gt; (where foldername is the directory to be compressed and filename.tgz is the resultant compressed file)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;c --- to create a tar file, writing the file starts at the beginning.&lt;br /&gt;f --- specifies the filename (which follows the f) used to tar into or to tar out from.&lt;br /&gt;z --- use zip/gzip to compress the tar file or to read from a compressed tar file.&lt;br /&gt;v --- verbose output, show the files being stored into or restored from the tar file.&lt;br /&gt;&lt;br /&gt;To see a tar file's table of contents use:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;tar tzf filename.tgz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;t --- table of contents, see the names of all files or those specified in other command line arguments.&lt;br /&gt;&lt;br /&gt;To uncompress a directory using tar, execute the following command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;tar xvzf filename.tgz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;x --- extract (restore) the contents of the tar file.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;.zip — a file compressed with ZIP compression&lt;/span&gt;&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;To compress a file with zip, type the following:&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;zip -r filename.zip files&lt;/span&gt; (filename represents the file you are creating and files represents the files you want to put in the new file)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To extract the contents of a zip file, type:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;unzip filename.zip&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can zip or gzip multiple files at the same time. List the files with a space between each one.&lt;br /&gt;&lt;br /&gt;ref : http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/getting-started-guide/s1-zip-tar.html&lt;br /&gt;     http://www.debianhelp.co.uk/bzandgzfiles.htm&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-8374525866361650053?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/8374525866361650053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=8374525866361650053' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8374525866361650053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8374525866361650053'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/08/compressuncompress-gzip-zip-and-tar.html' title='Compress/Uncompress Gzip, Zip, and Tar files'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-2020307958742310273</id><published>2008-07-26T11:52:00.004+05:30</published><updated>2008-07-26T12:01:40.161+05:30</updated><title type='text'>Creating tmpfs and swap space after partitions have already been written</title><content type='html'>&lt;div style="text-align: justify;"&gt;This how-to describes a process of creating a tmpfs and swap file system on your existing server, after the partition table has been written. I'll start off with a little history first. I was presented with a production server where there was only a / root partition and 500MB of swap allocated. We need to bump up RAM to 1GB, and I wanted to allocate more swap space. Also, I wanted to add an extra layer of security by making the /tmp directory noexec,nosuid. This is a nice method to counter script-kiddie attacks. It's by no means 'rock-solid', but can really help you on automated attacks. The solution is to use some disk space and create a file system. Once the file system has been created, you would mount it with special privileges.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;First let's work on swap&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code style="font-weight: bold;"&gt;dd if=/dev/zero of=/.swap bs=1024 count=500000&lt;br /&gt;mkswap /.swap&lt;br /&gt;swapon /.swap&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This created a 500 MB file using dd. Once our .swap file has been created we make the swap file system and activated the swap space.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The original /etc/fstab looked like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;/dev/hda1 /boot ext3  noauto,noatime 1 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;/dev/hda3 /  reiserfs noatime   0 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;/dev/hda2 none swap  sw    0 0&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;Now, we're going to add our additional swap space to /etc/fstab&lt;br /&gt;&lt;br /&gt;&lt;code style="font-weight: bold;"&gt;/.swap  swap swap  defaults  0 0&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;p&gt;Issuing a `top` command, we can see our swap now has: 1006028k (1GB).&lt;br /&gt;&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;Next, we're going to create a tmpfs file system&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="font-weight: bold;"&gt;dd if=/dev/zero of=/.tmpfs bs=1024 count=250000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mkfs -t ext3 /.tmpfs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mount -o loop,noexec,nosuid,rw /.tmpfs /tmp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;chmod 0777 /tmp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;chmod +t /tmp&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;This created a 250 MB file using dd, and mounted it to our /tmp mount point. Also, we added our permissions (noexec, nosuid) options. Now, no programs can be executed in /tmp. All we need to do now is adjust /etc/fstab&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style="font-weight: bold;"&gt;&lt;code&gt;/.tmpfs  /tmp ext3  loop,rw,nosuid,noexec 0 0&lt;/code&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;code style="font-weight: bold;"&gt;&lt;/code&gt;&lt;br /&gt;This isn't the ideal solution, but since this was a production box, rebuilding the partition table from scratch was an extremely ugly option.&lt;br /&gt;&lt;/div&gt;&lt;code style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-2020307958742310273?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/2020307958742310273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=2020307958742310273' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/2020307958742310273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/2020307958742310273'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/07/creating-tmpfs-and-swap-space-after.html' title='Creating tmpfs and swap space after partitions have already been written'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-7474874688578141125</id><published>2008-07-08T13:39:00.011+05:30</published><updated>2009-08-01T00:37:57.768+05:30</updated><title type='text'>iptables tutorial for beginners</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;---------------&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Iptables is a Linux based packet filtering firewall. Iptables interfaces to the Linux netfilter module to perform filtering of network packets. This can be to deny/allow traffic filter or perform Network Address Translation (NAT). With careful configuration iptables can be a very cost effective, powerful and flexible firewall or gateway solution. Iptables is available from http://www.netfilter.org/ or via your Linux distribution.&lt;br /&gt;&lt;br /&gt;In short, &lt;span style="font-weight: bold; font-style: italic;"&gt;iptables&lt;/span&gt; is a packet filtering tool which allows system administrator to define incoming and outgoing packets to and from the system using certain rules. Iptables can be confusing it's pretty straightforward once you get the hang of it.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Rules, Chains, and Tables&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Iptables rules are grouped into chains. A chain is a set of rules used to determine what to do with a packet. These chains are grouped into tables. Iptables has three built in tables filter, NAT, mangle. More tables can be added through iptables extensions.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Filter Table&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The filter table is used to allow and block traffic, and contains three chains INPUT, OUTPUT, FORWARD. The input chain is used to filter packets destined for the local system. The output chain is used to filter packets created by the local system. The forward chain is used for packets passing through the system, mainly used for gateways/routers.&lt;br /&gt;&lt;br /&gt;There are three real "chains" which iptables uses:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;* INPUT&lt;br /&gt;Which is used to grant or deny incoming connections to your machine.&lt;br /&gt;* OUTPUT&lt;br /&gt;Which is used to grant or deny outgoing connections from your machine.&lt;br /&gt;* FORWARD&lt;br /&gt;Which is used for forwarding packages across interfaces, only really needed (in    general) when you're setting up a gateway machine.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NAT Table&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The NAT table is used to setup the rules to rewrite packets allowing NAT to happen. This table also has 3 chains, PREROUTING, POSTROUTING, and OUTPUT. The prerouting chain is where packets come to prior to being parsed by the local routing table. The postrouting chain is where packets are sent after going through the local routing table.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The general form of an IP tables rule is:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;iptables -A CHAIN -p tcp [options] -j ACTION&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The CHAIN we've briefly covered before, "INPUT", "OUTPUT", "FORWARD", etc. Here "-A INPUT" means "append this rule to the input chain".&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The "-p tcp" means this rule applies only to TCP connections, not UDP. (To specify UDP connections you'd use "-p udp" instead.)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;"[options]" is where you specify what you wish to match against.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Finally "-j ACTION" is used to specify what to do to packets which match your rule. Usually an action will be one of "-j DROP" to drop the package, "-j ACCEPT", to accept the packet or "-j LOG" to log it.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Commands&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first step is to know iptables commands.&lt;br /&gt;&lt;br /&gt;Main commands&lt;br /&gt;&lt;br /&gt;*&lt;span style="font-weight: bold;"&gt; -A --append&lt;/span&gt; : Add the rule a the end of the specified chain&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -A INPUT ...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-D --delete&lt;/span&gt; : Allow to delete a chain.&lt;br /&gt;There's 2 way to use it, you can specify the number of the chain to delete or specify the rule to delete&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -D INPUT 1&lt;br /&gt;iptables -D INPUT --dport 80 -j DROP&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-R --replace&lt;/span&gt; : Allow to replace the specified chain&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -R INPUT 1 -s 192.168.0.1 -j DROP&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-I --insert&lt;/span&gt; : Allow to add a chain in a specific area of the global chain&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -I INPUT 1 --dport 80 -j ACCEPT&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-L --list&lt;/span&gt; : Display the rules&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -L # Display all the rules of the FILTER chains&lt;br /&gt;iptables -L INPUT # Display all the INPUT rules (FILTER)&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-F --flush&lt;/span&gt; : Delete all the rules of a chain&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -F INPUT # Delete all the rules of the INPUT chain&lt;br /&gt;iptables -F # Delete all the rules&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-N --new-chain&lt;/span&gt; : Allow to create a new chain&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -N LOG_DROP&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-X --delete-chain&lt;/span&gt; : Allow to delete a chain&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;iptables -X LOG_DROP # Delete the LOG_DROP chain&lt;br /&gt;iptables -X # Delete the chains&lt;br /&gt;&lt;br /&gt;* &lt;span style="font-weight: bold;"&gt;-P --policy&lt;/span&gt; : Allow to specify to the kernel the default policy of a chain ACCEPT, REJECT, DROP ...&lt;br /&gt;Code:&lt;br /&gt;iptables -P INPUT DROP&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Basic Uses&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The most common use of iptables is to simply block and allow traffic.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Allow Traffic&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Iptables allows you to allow traffic based on a number of different conditions such as Ethernet adapter, IP Address, port, and protocol.&lt;br /&gt;&lt;br /&gt;Allow incoming TCP traffic on port 22 (ssh) for adapter eth0&lt;br /&gt;iptables -A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT&lt;br /&gt;&lt;br /&gt;Allow incoming TCP traffic on port 80 (HTTP) for the IP range 192.168.0.1 to 192.168.0.254.&lt;br /&gt;iptables -A INPUT -s 192.168.0.0/24 -p tcp -m tcp --dport 80 -j ACCEPT&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Block Traffic&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Iptables can block traffic on the same conditions that traffic can be allowed.&lt;br /&gt;&lt;br /&gt;Blocks inbound TCP traffic port 22 (ssh)&lt;br /&gt;iptables -A INPUT -p tcp -m tcp --dport 22 -j DRROP&lt;br /&gt;&lt;br /&gt;Blocks inbound TCP traffic on port 80 (HTTP) from the IP 192.168.1.100&lt;br /&gt;iptables -A INPUT -s 192.168.1.100 -p tcp -m tcp --dport 80 -j DRROP&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Limit Traffic&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Along with allowing and denying traffic IP tables can be used to limit the number of connections allowed over time thresholds.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m sshbrute --set&lt;br /&gt;&lt;div style="text-align: justify;"&gt;iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m sshbrute --update --seconds 60 --hitcount 4 -j DRROP&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;[:p:] this is a common set of rules used to block brute force ssh attacks. The first rule makes sure the IP connecting is added to the sshbrute list. The second rule tells iptables to check the sshbrute list and if the packet threshold is exceeded to drrop the traffic.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Common Options and Switches&lt;br /&gt;-A -- adds a rule at the end of the chain&lt;br /&gt;&lt;div style="text-align: justify;"&gt;-I -- inserts the rule at the given rule number. If no rule number is given the rule is inserted at the head of the chain.&lt;br /&gt;&lt;/div&gt;-p -- protocol of the rule&lt;br /&gt;--dport the destination port to check on the rule&lt;br /&gt;-i -- interface on which the packet was received.&lt;br /&gt;-j -- what to do if the rule matches&lt;br /&gt;-s -- source IP address of packet&lt;br /&gt;-d -- destination IP address of packet&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Examples :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Drop all inbound telnet traffic&lt;br /&gt;iptables -I INPUT -p tcp --dport 23 -j DROP&lt;br /&gt;&lt;br /&gt;Drop all outbound web traffic&lt;br /&gt;iptables -I OUTPUT -p tcp --dport 80 -j DROP&lt;br /&gt;&lt;br /&gt;Drop all outbound traffic to 192.168.0.1&lt;br /&gt;iptables -I OUTPUT -p tcp --dest 192.168.0.1 -j DROP&lt;br /&gt;&lt;br /&gt;Allow all inbound web traffic&lt;br /&gt;iptables -I INPUT -p tcp --dport 80 -j ACCEPT&lt;br /&gt;&lt;br /&gt;Allow inbound HTTPS traffic from 10.2.2.4&lt;br /&gt;iptables -I INPUT -s 10.2.2.4 -p tcp -m tcp --dport 443 -j DROP&lt;br /&gt;&lt;br /&gt;Deny outbound traffic to 192.2.4.0-192.2.4.255&lt;br /&gt;iptables -I OUTPUT -d 192.2.4.6.0/24 -j DROP&lt;br /&gt;&lt;br /&gt;Allow incoming connections to port 21 from one IP address 11.22.33.44&lt;br /&gt;iptables -A INPUT -p tcp -m state --state NEW --dport 21 --source 11.22.33.44&lt;br /&gt;&lt;br /&gt;Deny all other incoming connections to port 21.&lt;br /&gt;iptables -A INPUT -p tcp -m state --state NEW --dport 21 -j DROP&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We used the "-m state --state NEW --dport 21" to match against new connections to port 21. Other options allow you to match against different things.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;ref:&lt;br /&gt;http://ubuntuforums.org/showthread.php?t=159661&lt;br /&gt;http://www.higherpass.com/linux/Tutorials/Iptables-Primer/&lt;br /&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-7474874688578141125?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/7474874688578141125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=7474874688578141125' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7474874688578141125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7474874688578141125'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/07/iptables-tutorial-for-beginners.html' title='iptables tutorial for beginners'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-2186620018532907938</id><published>2008-07-08T13:15:00.002+05:30</published><updated>2008-07-08T13:19:29.327+05:30</updated><title type='text'>Port Numbers</title><content type='html'>7/TCP,UDP        Echo&lt;br /&gt;15/TCP,UDP      NETSTAT&lt;br /&gt;20/TCP              FTP—data&lt;br /&gt;21/TCP              FTP—control (command)&lt;br /&gt;22/TCP,UDP        Secure Shell (SSH)—used for secure logins, file transfers (scp, sftp) and port forwarding&lt;br /&gt;23/TCP,UDP         Telnet protocol&lt;br /&gt;25/TCP,UDP         Simple Mail Transfer Protocol (SMTP)&lt;br /&gt;42/TCP,UDP         nameserver, ARPA Host Name Server Protocol&lt;br /&gt;43/TCP                 WHOIS protocol&lt;br /&gt;53/TCP,UDP         Domain Name System (DNS)&lt;br /&gt;79/TCP                  Finger protocol&lt;br /&gt;80/TCP                  Hypertext Transfer Protocol (HTTP)&lt;br /&gt;110/TCP                Post Office Protocol 3 (POP3)&lt;br /&gt;115/TCP               Simple File Transfer Protocol (SFTP)&lt;br /&gt;143/TCP,UDP      Internet Message Access Protocol (IMAP)&lt;br /&gt;156/TCP,UDP      SQL Service&lt;br /&gt;443/TCP              Hypertext Transfer Protocol over TLS/SSL (HTTPS)&lt;br /&gt;514/TCP              Shell&lt;br /&gt;546/TCP,UDP     DHCPv6 client&lt;br /&gt;547/TCP,UDP     DHCPv6 server&lt;br /&gt;873/TCP              rsync file synchronisation protocol&lt;br /&gt;901/TCP              Samba Web Administration Tool (SWAT)&lt;br /&gt;902/TCP              VMware Server Console[27]&lt;br /&gt;904/TCP              VMware Server Alternate&lt;br /&gt;1025/TCP            NFS-or-IIS&lt;br /&gt;1194/TCP,UDP    OpenVPN&lt;br /&gt;1433/TCP,UDP     Microsoft SQL Server database management system Server&lt;br /&gt;2049/UDP          Network File System&lt;br /&gt;2082/TCP          CPanel default&lt;br /&gt;2083/TCP          CPanel default SSL&lt;br /&gt;2083/TCP          CPanel default SSL&lt;br /&gt;2083/TCP          CPanel default SSL&lt;br /&gt;2095/TCP          CPanel default Web mail&lt;br /&gt;2096/TCP         CPanel default SSL Web mail&lt;br /&gt;2096/TCP         CPanel default SSL Web mail&lt;br /&gt;3306/TCP,UDP     MySQL database system&lt;br /&gt;3690/TCP,UDP     Subversion version control system&lt;br /&gt;5050/TCP              Yahoo! Messenger&lt;br /&gt;5432/TCP,UDP     PostgreSQL database system&lt;br /&gt;8080/TCP             Apache Tomcat&lt;br /&gt;8086/TCP             HELM Web Host Automation Windows Control Panel&lt;br /&gt;8087/TCP             SW Soft Plesk Control Panel&lt;br /&gt;8443/TCP             SW Soft Plesk Control Panel&lt;br /&gt;33434/TCP,UDP  traceroute&lt;br /&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-2186620018532907938?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/2186620018532907938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=2186620018532907938' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/2186620018532907938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/2186620018532907938'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/07/port-numbers.html' title='Port Numbers'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-4958238410321514596</id><published>2008-06-19T11:52:00.008+05:30</published><updated>2009-03-24T20:50:20.677+05:30</updated><title type='text'>Versus Versus</title><content type='html'>&lt;span style="font-weight: bold;"&gt;ext2 vs ext3&lt;/span&gt;&lt;br /&gt;-------------------&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The main difference is that ext3 is a journaling file system. ie, they logs changes to a journal (usually a circular log in a dedicated area) before committing them to the main file system.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Dynamic URLs vs Static URLs&lt;br /&gt;&lt;/span&gt;------------------------------------------------&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;p align="justify"&gt;Websites that utilize databases which can insert content into a webpage by way of a dynamic script like PHP or JavaScript are increasingly popular. This type of site is considered dynamic. Many websites choose dynamic content over static content. This is because if a website has thousands of products or pages, writing or updating each static by hand is a monumental task. &lt;/p&gt; &lt;p align="justify"&gt; There are two types of URLs: dynamic and static. A dynamic URL is a page address that results from the search of a database-driven web site or the URL of a web site that runs a script. In contrast to static URLs, in which the contents of the web page stay the same unless the changes are hard-coded into the HTML, dynamic URLs are generated from specific queries to a site's database. The dynamic page is basically only a template in which to display the results of the database query. Instead of changing information in the HTML code, the data is changed in the database.&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;ref: &lt;a href="http://http//www.webconfs.com/dynamic-urls-vs-static-urls-article-3.php"&gt;http://www.webconfs.com/dynamic-urls-vs-static-urls-article-3.php&lt;/a&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-weight: bold;"&gt;LILO vs GRUB&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;-----------------------&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;Both are linux boot loaders. LILO is little outdated than GRUB. Now most of the linux distribution uses GRUB boot loader. Another important advantages are&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;GRUB has a more powerful, interactive command line interface. LILO,  on the other hand, only allows one command with arguments.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;LILO stores information about the location of the kernel or other  operating system on the Master Boot Record (MBR). Every time a new  operating system or kernel is added to the system, the Stage 1 LILO  bootloader has to be manually overwritten, otherwise there is no way to  boot the new OS or kernel. This method is more risky than the method  used by GRUB because a mis-configured LILO configuration file may leave  the system unbootable (a popular way to fix this problem is to boot  from Knoppix or another live CD, chroot into the partition with  mis-configured lilo.conf and correct the problem). On the other hand,  correcting a mis-configured GRUB is comparatively simple as GRUB will  default to its command line interface where the user can boot the  system manually. This flexibility is probably the main reason why many  users nowadays prefer GRUB over LILO.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;li style="text-align: justify;"&gt;Unlike LILO, GRUB has a web site. It also has a manual, FAQ, a bug  tracker, a developer mailing list and a logo. LILO has none of those. &lt;/li&gt;&lt;/ul&gt;ref: &lt;a href="http://lwn.net/Articles/89772/"&gt;http://lwn.net/Articles/89772/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-4958238410321514596?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/4958238410321514596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=4958238410321514596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/4958238410321514596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/4958238410321514596'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/06/versus-versus.html' title='Versus Versus'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-4719821635885963457</id><published>2008-05-07T13:54:00.005+05:30</published><updated>2008-07-25T01:03:26.188+05:30</updated><title type='text'>MySQL in a nutshell</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). I was first released in January, 1998.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In most cases the developers of database applications expect the systems administrator to be able to independently prepare a database for their applications to use. The steps to do this include:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;1. Install and start MySQL.&lt;br /&gt;2. Create a MySQL "root" user.&lt;br /&gt;3. Create a regular MySQL user that the application will use to access the database.&lt;br /&gt;4. Create your application's database.&lt;br /&gt;5. Create your database's data tables.&lt;br /&gt;6. Perform some basic tests of your database structure.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The /etc/my.cnf file is the main MySQL configuration file. It sets the default MySQL database location and other parameters. The typical home/SOHO user won't need to edit this file at all.According to the /etc/my.cnf file, MySQL databases are usually located in a subdirectory of the /var/lib/mysql/ directory. If you create a database named test, then the database files will be located in the directory /var/lib/mysql/test.&lt;br /&gt;&lt;br /&gt;MySQL stores all its username and password data in a special database named mysql.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Creating a MySQL "root" Account&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Only two steps are necessary for a brand new MySQL installation.&lt;br /&gt;&lt;br /&gt;1. Make sure MySQL is started.&lt;br /&gt;2. Use the mysqladmin command to set the MySQL root password. The syntax is as follows:&lt;br /&gt;&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;mysqladmin -u root password new-password&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;MySQL has its own command line interpreter (CLI). You can access the MySQL CLI using the mysql command followed by the -u option for the username and -p&lt;br /&gt;&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;mysql -u root -p&lt;br /&gt;&lt;br /&gt;Creating a database&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;mysql&gt; create database databasename;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Deleting a database&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;mysql&gt; drop database databasename;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Adding user&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can add users and give privileges for user to access database using grant command.&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;mysql&gt; grant all privileges on database.* to username@"servername" identified by 'password';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Example :&lt;/span&gt;&lt;br /&gt;Creating a database named exampledb and creating a user named newuser with password newuser&lt;br /&gt;&lt;br /&gt;mysql&gt; create database exampledb&lt;br /&gt;mysql&gt; grant all privileges on exampedb.* to newuser@"servername" identified by 'newuser';&lt;br /&gt;mysql&gt; flush privileges;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;For changing mysql password for the user username as root from mysql command prompt &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;mysql&gt; UPDATE mysql.user SET Password = OLD_PASSWORD('newuser') WHERE Host = 'localhost' AND User = 'newuser';&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to Reset mysql root password&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Stop mysqld&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;/etc/init.d/mysql stop&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;2. Start mysql using skip grant tables option&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;/etc/init.d/mysql start --skip-grant-tables --user=root&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3. Connect to the mysqld server with this command:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;mysql -u root &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;4. Issue the following statements&lt;br /&gt;mysql&gt; &lt;span style="font-weight: bold;"&gt;UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';&lt;/span&gt;&lt;br /&gt;mysql&gt; &lt;span style="font-weight: bold;"&gt;flush privileges;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5. You should be able to connect using the new password.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Recovering / Changing Your MySQL Root Password&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The steps you need are:&lt;br /&gt;&lt;br /&gt;1) Stop MySQL&lt;br /&gt;# service mysqld stop&lt;br /&gt;&lt;br /&gt;2) Start MySQL in Safe mode with the mysqld_safe command and tell it not to read the grant tables with all the MySQL database passwords.&lt;br /&gt;&lt;br /&gt;# mysqld_safe --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;&lt;br /&gt;3) MySQL is now running without password protection. You now have to use the familiar mysql -u root command to get the mysql&gt; command prompt. ( -p flag is not required) As expected, you will not be prompted for a password.&lt;br /&gt;&lt;br /&gt;# mysql -u root&lt;br /&gt;&lt;br /&gt;4) You will now have to use the mysql database which contains the passwords for all the databases on your system and modify the root password. In this case we are setting it to ack33nsaltf1sh.&lt;br /&gt;&lt;br /&gt;mysql&gt; use mysql;&lt;br /&gt;&lt;br /&gt;5) Exit MySQL and restart the mysqld daemon.&lt;br /&gt;&lt;br /&gt;mysql&gt; exit&lt;br /&gt;&lt;br /&gt;# service mysqld restart&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MySQL Database Backup&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The syntax for backing up a MySQL database is as follows:&lt;br /&gt;# &lt;span style="font-weight: bold;"&gt;mysqldump -u [username] -p[password] [database] &gt; [backup_file]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;example :&lt;/span&gt;&lt;br /&gt;#mysqldump -u newuser -pnewuser example &gt; example.sql&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MySQL Database Restoration&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;#mysql -u [username] -p[password] [database] &lt; [backup_file]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;example :&lt;/span&gt;&lt;br /&gt;#mysql -u newuser -pnewuser example &lt; style="font-weight: bold;"&gt;Some useful mysql commands&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;List all your MySQL databases:&lt;/span&gt;&lt;br /&gt;mysql&gt; show databases;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Listing the data tables in MySQL database:&lt;/span&gt;&lt;br /&gt;mysql&gt; use databasename;&lt;br /&gt;mysql&gt; show tables;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;example : &lt;/span&gt;&lt;br /&gt;mysql&gt; use exampledb;&lt;br /&gt;mysql&gt; show tables;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Viewing your mySQL database's table structure:&lt;/span&gt;&lt;br /&gt;mysql&gt; describe tablename;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Viewing the contents of a table:&lt;/span&gt;&lt;br /&gt;mysql&gt; select * from tablename limit 1;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-4719821635885963457?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/4719821635885963457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=4719821635885963457' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/4719821635885963457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/4719821635885963457'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/05/mysql.html' title='MySQL in a nutshell'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-7558410484581579833</id><published>2008-05-05T18:20:00.009+05:30</published><updated>2009-08-01T00:41:05.696+05:30</updated><title type='text'>Some Important Definitions</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;http connection&lt;/span&gt; : http connection means the requests server receives for accessing your website. In other words http connection indicates the traffic to your website.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;iptables :&lt;/span&gt; it is a packet filtering tool which allows system administrator to define incoming and outgoing packets to a system using certain rules.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Virtual Private Server(VPS):&lt;/span&gt;  is a virtual private server, which is functionally identical to an isolated standalone server, with its own IP addresses, processes, files, its own users database, its own configuration files, its own applications, system libraries, and so on. Virtual Private Servers share one Hardware Node and one OS kernel. However, they are isolated from each other.Virtual Private Server 0 is used to designate the Hardware Node itself.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Virtuozzo :&lt;/span&gt; which allows you to create multiple isolated Virtual Private Servers on a single physical server to share hardware, licenses, and management effort with maximum efficiency.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;SSH :&lt;/span&gt; SSH stands for Secure Shell. It is a protocol for logging on to a remote machine and executing commands on that machine. It provides secure encrypted communications between two untrusted hosts over an insecure network.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Domainkeys&lt;/span&gt;: DomainKeys is an email authentication technology developed by Yahoo, and is primarily used as an additional anti-spam and anti-phishing method and to prove and protect email sender identity.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;fsck&lt;/span&gt; : The system utility fsck (for "file system check" or "file system consistency check") is a tool for checking the consistency of a file system in the Unix system.&lt;br /&gt;&lt;br /&gt;Generally, fsck is run automatically at boot time when the system detects that a file system is in an inconsistent state, indicating a non-graceful shutdown, such as a crash or power loss. Typically, fsck utilities provide options for either interactively repairing damaged file systems (the user must decide how to fix specific problems), automatically deciding how to fix specific problems (so the user doesn't have to answer any questions), or reviewing the problems that need to be resolved on a file system without actually fixing them.&lt;br /&gt;&lt;br /&gt;Fsck can also be run manually by the system administrator if there is believed to be a problem with the file system.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;IP&lt;/span&gt; : The Internet Protocol (IP) is a protocol used for communicating data across a packet-switched internetwork. IP is a network layer protocol in the Internet protocol suite and is encapsulated in a data link layer protocol (e.g., Ethernet). In short, the way in which packets of data are addressed and sent across the Internet.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Firewall&lt;/span&gt; : A firewall is a program configured to permit, deny, or encrypt incoming and outgoing traffic in a system based on a set of rules and other criteria.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;runlevel&lt;/span&gt; : The term runlevel refers to a mode of operation in one of the computer. Conventionally, seven runlevels exist, numbered from zero to six, though up to ten, from zero to nine, may be used. When a computer enters runlevel zero, it halts, and when it enters runlevel six, it reboots.&lt;br /&gt;Additional runlevels are as follows :&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;1     Single-User Mode&lt;br /&gt;2     Multi-User Mode&lt;br /&gt;3     Multi-User Mode with Networking&lt;br /&gt;4     Unused&lt;br /&gt;5     X11&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;spf record&lt;/span&gt; : SPF helps mail servers distinguish forgeries from real mail by making it possible for a domain owner to say, "I only send mail from these machines." That way, if any other machines try to send mail from that domain, the mail server knows that the FROM address is forged.&lt;br /&gt;&lt;br /&gt;Due to the fact that a significant majority of SPAM comes from forged addresses, a new Sender Policy Framework (SPF) standard is being implemented by a number of ISPs and mail hosts, including several major providers (Hotmail, Yahoo, AOL, etc). Those providers have begun to require SPF to allow mail through their networks. Mail systems will need SPF records for their domains if they want their mail to be accepted by those providers.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Protocol&lt;/span&gt; - An agreed upon format for transmitting data between two devices. In short a 'rule'.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;IP address&lt;/span&gt; - The format of an IP address is a 32-bit(4 byte) numeric address written as four numbers separated by periods. Each number can be zero to 255. For example, 1.160.10.240 could be an IP address. It is analogous to your telephone number in that the telephone number is used by the telephone network to direct calls to you. The IP address is used by the Internet to direct data to your computer, e.g. the data your web browser retrieves and displays when you surf the net.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Web server&lt;/span&gt; - A computer that delivers or "serves up" web pages which are then viewed in web browsers. Requires an Internet connection, server software, an IP address, and a domain name.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Subnet&lt;/span&gt;—A portion of a network sharing a particular subnet address.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Subnet mask&lt;/span&gt; - A 32-bit combination used to describe which portion of an address refers to the subnet and which part refers to the host.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interface&lt;/span&gt; - A network connection.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Daemon&lt;/span&gt; : a daemon (pronounced /ˈdiːmən/ or /ˈdeɪmən/[1]) is a computer program that runs in the background, rather than under the direct control of a user; they are usually initiated as background processes. Typically daemons have names that end with the letter "d": for example, syslogd, the daemon that handles the system log, or sshd, which handles incoming SSH connections.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Transmission Control Protocl (TCP)&lt;/span&gt; : is the protocol that creates connections between two computer over the internet, allowing them to pass data back and forth. TCP is made to allow the transmitted data to be reassembled into the proper form when it reached its destination.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;chkrootkit (Check Rootkit)&lt;/span&gt; : is a common Unix-based program intended to help system administrators check their system for known rootkits.&lt;br /&gt;&lt;br /&gt;A &lt;span style="font-weight: bold;"&gt;rootkit&lt;/span&gt; is a program (or combination of several programs) designed to take fundamental control (in Unix terms "root" access, in Windows "Administrator" access) of a computer system, without authorization by the system's owners and legitimate managers. Access to the hardware (e.g., the reset switch) is rarely required as a rootkit is intended to seize control of the operating system running on the hardware.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Load Average&lt;/span&gt; : It is the &lt;span class="highlight"&gt;average&lt;/span&gt; sum of the number of processes waiting in the run-queue plus the number currently executing over 1, 5, and 15 minute time periods.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-7558410484581579833?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/7558410484581579833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=7558410484581579833' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7558410484581579833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7558410484581579833'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/05/some-important-definitions.html' title='Some Important Definitions'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-7748514365407809282</id><published>2008-05-01T10:52:00.023+05:30</published><updated>2009-11-04T19:33:08.816+05:30</updated><title type='text'>Useful Linux Commands</title><content type='html'>&lt;div style="text-align: justify;"&gt;Command to find files accessed in last 30 days. will find files that is accessed in last 30 days, under root folder.&lt;br /&gt;&lt;/div&gt;# find / type f -atime -30&lt;br /&gt;----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;List contents of a folder along with contents of its subfolder. But it will traverse only to a depth of one. ie, it will not show the contents of subfolder's subfolder.&lt;br /&gt;&lt;/div&gt;# ls  *&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;To print the iptables rules along with line number.&lt;br /&gt;&lt;/div&gt;# iptables -L --line-numbers&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;To find a particular rule with rule number #; where # is the rule number you want to list&lt;br /&gt;# iptables -L OUTPUT --line-numbers | grep ^#&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Change permission only for folders&lt;br /&gt;# find . -type d -exec chmod 755 {} \;&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;List with 777 permission&lt;br /&gt;#find . -type d -perm 777&lt;br /&gt;--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;To list all the processes listening to port 80&lt;br /&gt;# lsof -i TCP:80|awk {'print $2'}&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;To kill all the process listening to apache port 443/80&lt;br /&gt;# lsof -i TCP:443|awk {'print $2'} | xargs kill -9&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Recursively chmod only directories&lt;br /&gt;find . -type d -exec chmod 755 {} \;&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Recursively set the execute bit on every directory&lt;br /&gt;chmod -R a+X *&lt;br /&gt;The +X flag sets the execute bit on directories only&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Recursively chmod only files&lt;br /&gt;find . -type f -exec chmod 644 {} \;&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Recursively chmod only PHP files (with extension .php)&lt;br /&gt;find . -type f -name '*.php' -exec chmod 644 {} \;&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Find all files in /home/user/demo directory&lt;br /&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;$ find /home/user/demo -print&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Now find all files in /home/user/demo directory with permission 777&lt;br /&gt;&lt;strong&gt;&lt;span style="font-weight: normal;"&gt;$ find /home/user/demo -perm 777 -print&lt;/span&gt;&lt;br /&gt;&lt;/strong&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Next you need to apply chmod on all these files using -exec option:&lt;br /&gt;&lt;strong style="font-weight: normal;"&gt;$ find /home/user/demo -perm 777 -print -exec chmod 755 {} \;&lt;/strong&gt;&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Command to find files modified on July 12&lt;br /&gt;ll|grep dr|awk '{print $9}' &gt; 123&lt;br /&gt;for i in `cat 123`;do ls -ld $i;done|grep "Jul 12"&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;How to See the SSH password guesses&lt;br /&gt;&lt;br /&gt;First, find the PID of the listening SSH daemon process:&lt;br /&gt;# ps axuww | egrep 'PID|ssh'&lt;b&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/b&gt;   Now become &lt;tt&gt;root&lt;/tt&gt; and   attach to the running daemon with &lt;tt&gt;strace:&lt;br /&gt;# &lt;/tt&gt;strace -f -e 'read,write' -p&lt;em&gt;12345&lt;/em&gt;&lt;b&gt;&lt;b&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/b&gt;&lt;/b&gt;----------------------------------------------------------------------------------------------------------------------------------------&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Screen Command&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Command to create screen:&lt;/div&gt;&lt;div&gt;# screen -S screen_name&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To exit from screen:&lt;/div&gt;&lt;div&gt;Just close the shell without logout&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To list all running screens:&lt;/div&gt;&lt;div&gt;# screen -ls&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To login to a particular screen with screen name "xxxx.screen_name"&lt;/div&gt;&lt;div&gt;# screen -r xxxx.screen_name&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-7748514365407809282?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/7748514365407809282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=7748514365407809282' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7748514365407809282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7748514365407809282'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/05/some-useful-linux-commands.html' title='Useful Linux Commands'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-1605127693634796557</id><published>2008-04-30T19:23:00.005+05:30</published><updated>2008-04-30T19:32:57.628+05:30</updated><title type='text'>CentOS Vs Redhat(RHEL)</title><content type='html'>1) CentOS build from the Source RPM of RHEL (from redhat)&lt;br /&gt;2) RHEL get faster update then CentOS because, CentOS need to wait to get the source rpm from the RHEL repository (sometime centOS community come with their own patches, but there is very small delay when the Redhat Update)&lt;br /&gt;3) CentOS free version of RHEL ( which means there is no license fee)&lt;br /&gt;&lt;br /&gt;If you ask me, if you can get RHEL license free ( most of the planet server comes with free license), use RHEL. If you are going to pay for RHEL license fee more then 50+USD. I would use the CentOS.&lt;br /&gt;&lt;br /&gt;NB: CentOS is RedHat Enterprise without the trade mark / copyright.  The same functionality, the same OS; though RedHat Enterprise typically has a faster update cycle especially RedHat Enterprise 3 or CentOS 3&lt;br /&gt;                                                                                                                                                                      .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-1605127693634796557?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/1605127693634796557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=1605127693634796557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/1605127693634796557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/1605127693634796557'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/04/centos-vs-redhatrhel.html' title='CentOS Vs Redhat(RHEL)'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-4101632803189271532</id><published>2008-03-01T15:22:00.006+05:30</published><updated>2008-11-24T16:02:56.706+05:30</updated><title type='text'>Some Common Issues</title><content type='html'>Website Down&lt;br /&gt;---------------&lt;br /&gt;&lt;br /&gt;1. Domain Accesible from our end&lt;br /&gt; *Check if his IP is blocked in server firewall.&lt;br /&gt; *If not, check if he has changed his DNS recently. If yes, Propagation Delay.&lt;br /&gt; *If not, check .htaccess file for any rules&lt;br /&gt;&lt;br /&gt;2. Domain NOT Accessible from our end&lt;br /&gt; *Check if domain is registered&lt;br /&gt; *Check if domain is expired&lt;br /&gt; *Check if Server is down&lt;br /&gt; *Check if WebServer is running : pgrep httpd&lt;br /&gt; *Check if its resolving to correct IP, if not check the NameServers using "whois"&lt;br /&gt; *Check if it has got an entry in httpd.conf file&lt;br /&gt; *Try renaming .htaccess file from its DocumentRoot&lt;br /&gt; *Check if the folder/file permissions are correct&lt;br /&gt;&lt;br /&gt;3. Website showing Wrong Page&lt;br /&gt; *Check if its resolving to correct IP(If its recently transfered to a new server)&lt;br /&gt;*Check if it has got Correct DocumentRoot in httpd.conf file&lt;br /&gt;*Check if the IP address we get using host and the Virtualhost entry for domain in httpd.conf     file matches&lt;br /&gt;* Try clearing Browser Cache(After an upload)&lt;br /&gt;&lt;br /&gt;4. Website showing "Internal Server Error"&lt;br /&gt;*Check for permissions/ownership of index.* file&lt;br /&gt;*Check the permission of parent folders&lt;br /&gt;*Try renaming .htaccess file&lt;br /&gt;&lt;br /&gt;5. Error_Log showing&lt;br /&gt;a)No space left on device: Couldn't create accept lock;&lt;br /&gt;     This is an issue due to Semaphore Issue.&lt;br /&gt;&lt;pre&gt;You can remove the semaphore memory using the below command&lt;br /&gt;&lt;br /&gt;ipcs -s | grep nobody | perl -e 'while (&lt;stdin&gt;) { @a=split(/\s+/); print&lt;br /&gt;`ipcrm sem $a[1]`}'&lt;br /&gt;&lt;br /&gt;NOTE : replace nobody with your WebServer username. In some cases it can be "apache".&lt;/stdin&gt;&lt;/pre&gt;  b)mod_security: Access denied with code 403&lt;br /&gt;-This is an issue caused since mod_security module is enabled for Apache&lt;br /&gt;-You need to try disabling mod_security for this domain&lt;br /&gt;&lt;br /&gt;c) PHP Warning: mysql_connect() : Access denied for user test@localhost in filename&lt;br /&gt;-Its an issue since the MySQL connection Parameters are not correctly specified&lt;br /&gt;-Open the filename specified on error line and note down the username, password and host given to access the database&lt;br /&gt;-Login as root user to MySQL prompt and give the "grant all" command with the respective username, password, host for the database&lt;br /&gt;d)[client IP] client denied by server configuration: filename&lt;br /&gt;-Its an issue since the particular IP might be denied to access the website&lt;br /&gt;-Open .htaccess in the domains DocumentRoot and look for "deny from" line&lt;br /&gt;-Search for the IP/Network and if found try removing it&lt;br /&gt;-If not resolved, try backing up the .htaccess file&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;SSL Certificate Error&lt;br /&gt;----------------------&lt;br /&gt;&lt;br /&gt;1.Verifiying the Certificate&lt;br /&gt; *Access the domain using https:// and double click on the lock at Bottom-Right Corner&lt;br /&gt; *Click on View button and verify it to see if the SSL Certificate has got expired&lt;br /&gt; *If its expired goto next step&lt;br /&gt;2.Re-Installing the Certificate&lt;br /&gt; *You can try Installing it from WHM -&gt; "Install a SSL Certificate and Setup the Domain"&lt;br /&gt; *Enter the Domain, Username and IP Address, which will fetch the certificates automatically   and click on Submit&lt;br /&gt; *If it fails, get the crt and key from the client&lt;br /&gt; *Once you have got that, login to shell as root user and goto "/usr/share/ssl"&lt;br /&gt; *Now "cd certs" and rename files domain.crt and domain.cabundle to something else&lt;br /&gt; *Now "cd ../private" and rename file domain.key to something else&lt;br /&gt; *Try re-installing the certificate by pasting .crt and .key from what client have send to you&lt;br /&gt; *If its still showing error, ask the client to contact SSL provider and re-issue certificate and key&lt;br /&gt; for the domain&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;allow_url_fopen&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To enable allow_url_fopen for a single account in a server add the following into httpd.conf&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;php_admin_flag allow_url_fopen On&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-4101632803189271532?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/4101632803189271532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=4101632803189271532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/4101632803189271532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/4101632803189271532'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/03/some-common-issues.html' title='Some Common Issues'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-7159929460048714084</id><published>2008-02-29T00:51:00.007+05:30</published><updated>2008-07-26T10:42:56.492+05:30</updated><title type='text'>Basic qmail commands</title><content type='html'>&lt;span&gt;These files are in location &lt;span style="font-weight: bold;"&gt;/var/qmail/bin&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;qmail-clean&lt;/span&gt; --- clean up the queue directory&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;qmail-getpw&lt;/span&gt; -- qmail-getpw finds the user that controls a particular address, local.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;qmail-inject&lt;/span&gt; --- preprocess and send a mail message&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;qmail-qread&lt;/span&gt; --- list outgoing messages and recipients. qmail-qread must be run either  as  root  or  with user id qmails and group id qmail.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;qmail-qstat&lt;/span&gt; ---- summarize status of mail queue&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;qmail-queue&lt;/span&gt; -- queue a mail message for delivery. qmail-queue reads a mail message from descriptor 0. It then reads envelope information from descriptor 1. It places the message into the  outgoing queue for future delivery by qmail-send.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;qmail-remote&lt;/span&gt; -- send mail via SMTP&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;qmail-remote host sender recip [ recip ... ] mail-remote reads a mail message from its input  and  sends the message to one or more recipients at a remote host.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;qmail-send&lt;/span&gt; ----- deliver mail messages from the queue&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;qmail-start&lt;/span&gt; - turn on mail delivery. invokes qmail-send, qmail-lspawn,  qmail-rspawn, and  qmail-clean.   These  four daemons cooperate to deliver messages from the queue.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;splogger&lt;/span&gt; - make entries in syslog&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;qmail-showctl&lt;/span&gt; - analyze the qmail configuration files&lt;br /&gt;&lt;br /&gt;The mail log file in the location &lt;span style="font-weight: bold;"&gt;/var/log/send/current . &lt;/span&gt;Here you can find the log of send/received mail.&lt;br /&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-7159929460048714084?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/7159929460048714084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=7159929460048714084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7159929460048714084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7159929460048714084'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/02/qmail.html' title='Basic qmail commands'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-6447053701041393415</id><published>2008-02-25T02:21:00.021+05:30</published><updated>2009-04-22T20:06:09.932+05:30</updated><title type='text'>Tips &amp; Tricks</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Linux Tips &amp;amp; Tricks&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;strong style="font-style: italic; font-weight: bold;"&gt;&lt;span style=""&gt;&lt;span style="text-decoration: underline;"&gt;How to See the SSH password guesses&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First, find the PID of the listening SSH daemon process:&lt;br /&gt;# ps axuww | egrep 'PID|ssh'&lt;b&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Now become &lt;/span&gt;&lt;tt&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;root&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; and attach to the running daemon with &lt;/span&gt;&lt;tt&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;strace:&lt;br /&gt;# &lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;strace -f -e 'read,write' -p&lt;/span&gt;&lt;em&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;12345&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;strong style="font-style: italic; font-weight: bold;"&gt;&lt;span style=""&gt;&lt;span style="text-decoration: underline;"&gt;Convert 'man' pages to pdf format&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;Here is the way to convert man pages to PDF format&lt;br /&gt;&lt;em&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;# &lt;/span&gt;&lt;/em&gt;man&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;tt&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;-t man | ps2pdf - &gt; man.pdf&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Cpanel Tips &amp;amp; Tricks&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="text-decoration: underline;"&gt;Installing imagemagick on a cpanel server&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;p&gt;1. Log into your server as root&lt;br /&gt;2. Create a new directory as below :&lt;br /&gt;mkdir /home/cpimins&lt;br /&gt;3. cd /home/cpimins&lt;br /&gt;4. wget http://layer1.&lt;a href="http://www.eukhost.com/dedicated-server-hosting.php"&gt;cpanel&lt;/a&gt;.net/magick.tar.gz&lt;br /&gt;5. tar zxvf magick.tar.gz&lt;br /&gt;6. cd magick&lt;br /&gt;7. /scripts/installrpm ImageMagick&lt;br /&gt;8. /scripts/installrpm ImageMagick-devel&lt;br /&gt;9. sh ./install&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Addhandler&lt;br /&gt;apache 1.3.x vs apache 2.x&lt;br /&gt;&lt;br /&gt;---------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-6447053701041393415?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/6447053701041393415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=6447053701041393415' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/6447053701041393415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/6447053701041393415'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/02/coming-soon_25.html' title='Tips &amp; Tricks'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-1604759158897617642</id><published>2008-02-25T02:15:00.008+05:30</published><updated>2008-03-01T16:23:59.471+05:30</updated><title type='text'>PHP CGI vs Apache Module Install</title><content type='html'>There are two ways to install PHP on your server:&lt;br /&gt;&lt;br /&gt;1) As an APACHE module: This method provides the fastest operation of PHP and is generally more compatible with scripts and other server software.&lt;br /&gt;&lt;br /&gt;2) As a CGI binary: This method is used when security is key. When there are several web sites on one server, this method provides better tracking of each domains use of PHP. The price is slower PHP.&lt;br /&gt;&lt;br /&gt;If you have your own server, you want to install PHP as an Apache module.&lt;br /&gt;&lt;br /&gt;What are the steps to compile php as CGI?&lt;br /&gt;&lt;br /&gt;Just run ./configure again and don't specify "--with-apxs" or "--with-apache".&lt;br /&gt;&lt;br /&gt;You can see a good tutorial of installing php as cgi and as an apache module in below link&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;for linux :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;http://blazonry.com/scripting/install_apache.php&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;for windows :&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;http://www.php-mysql-tutorial.com/install-apache-php-mysql.php&lt;br /&gt;                                                                                                                                                                .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-1604759158897617642?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/1604759158897617642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=1604759158897617642' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/1604759158897617642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/1604759158897617642'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/02/php-cgi-vs-apache-module-install_25.html' title='PHP CGI vs Apache Module Install'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-8252913612935052799</id><published>2008-02-25T01:48:00.012+05:30</published><updated>2009-05-09T09:16:12.680+05:30</updated><title type='text'>.htaccess</title><content type='html'>&lt;div style="text-align: justify;"&gt;.htaccess is an access control file that provides a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof. .htaccess files should be used in a case where the content providers need to make configuration changes to the server on a per-directory basis, but do not have root access on the server system. In the event that the server administrator is not willing to make frequent configuration changes, it might be desirable to permit individual users to make these changes in .htaccess files for themselves.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Note: If you want to call your .htaccess file something else, you can change the name of the file using the AccessFileName directive. For example, if you would rather call the file .config then you can put the following in your server configuration file:&lt;br /&gt;&lt;br /&gt;AccessFileName .config&lt;br /&gt;&lt;br /&gt;Some tips about .htaccess file&lt;br /&gt;-------------------------------------&lt;br /&gt;&lt;div style="text-align: justify;"&gt;CHMOD the htaccess file to 644 or (RW-R--R--)&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;htaccess files must be uploaded as ASCII mode, not BINARY&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;htaccess files affect the directory they are placed in and all sub-directories.&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;The use of .htaccess files can be disabled completely by setting the AllowOverride directive to "none" AllowOverride None [Options, FileInfo, AuthConfig, Limit]&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;.htaccess files can override the &lt;directory&gt; sections for the corresponding directory, but will be overriden by other types of configuration sections from the main configuration files. This fact can be used to enforce certain configurations, even in the presence of a liberal AllowOverride setting. For example, to prevent script execution while allowing anything else to be set in .htaccess you can use:&lt;br /&gt;&lt;/directory&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;&lt;directory&gt;&lt;br /&gt;Allowoverride All&lt;br /&gt;&lt;/directory&gt;&lt;br /&gt;&lt;br /&gt;&lt;location&gt;&lt;br /&gt;Options +IncludesNoExec -ExecCGI&lt;br /&gt;&lt;br /&gt;&lt;/location&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Another common use of .htaccess files is to enable Server Side Includes for a particular  directory. This may be done with the following configuration directives, placed in a .htaccess file in the desired directory:&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;Options +Includes&lt;br /&gt;AddType text/html shtml&lt;br /&gt;AddHandler server-parsed shtml&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Finally, you may wish to use a .htaccess file to permit the execution of CGI programs in a particular directory. This may be implemented with the following configuration:&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;Options +ExecCGI&lt;br /&gt;AddHandler cgi-script cgi pl&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;To stop people from viewing a particular directory  in your site, include this line in the .htaccess:&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;files&gt;order allow,deny&lt;br /&gt;deny from all&lt;br /&gt;&lt;br /&gt;&lt;/files&gt;&lt;span style="font-family: georgia;font-size:130%;" &gt;To stop everyone expect &lt;/span&gt;&lt;span&gt;&lt;span style="font-family: georgia;font-size:130%;" &gt;one &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: georgia;font-size:130%;" &gt; from viewing a particular directory  in your site add the following in&lt;br /&gt;.htaccess file.  Replace IP with the public IP of the one who you want to enable access to the link&lt;br /&gt;&lt;/span&gt;&lt;files&gt;&lt;br /&gt;order deny,allow&lt;br /&gt;deny from all&lt;br /&gt;allow from IP&lt;br /&gt;&lt;br /&gt;&lt;/files&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;You can use .htaccess file to redirect your website. Two examples using redirect rules are as follows&lt;br /&gt;&lt;span style="font-family:monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre&gt;RewriteCond %{HTTP_HOST} ^.*mysite-1.com$ [NC]&lt;br /&gt;RewriteRule ^(.*)$ http://mysite-1.myothersite.com/$1 [R=301,L]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;&lt;br /&gt;RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [OR]&lt;br /&gt;RewriteCond %{HTTP_HOST} ^www.subdomain.domain.com$&lt;br /&gt;RewriteRule .* http://otherdomain.com/ [r]&lt;span style="font-family:Georgia,serif;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family:Georgia,serif;"&gt;To redirect public_html directory to a subdirectory (for example to redirect www.domain.com to www.domain.com/test)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;put the following code in a .htaccess file in public_html directory&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:85%;"&gt;RewriteEngine On&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;RewriteRule ^(.*)$  test/$1 [L]&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;To execute php files in the directory as php5 code&lt;br /&gt;AddHandler application/x-httpd-php5 .php&lt;br /&gt;&lt;span style="font-family:Georgia,serif;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-8252913612935052799?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/8252913612935052799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=8252913612935052799' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8252913612935052799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/8252913612935052799'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/02/php-cgi-vs-apache-module-install.html' title='.htaccess'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-985872163295741762.post-7258592840741043234</id><published>2008-02-13T22:02:00.009+05:30</published><updated>2008-02-25T02:17:30.616+05:30</updated><title type='text'>Welcome to Art of Linux</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;Articles in this blog are just an overview of what they are... If you need a deeper knowledge you have stepped into a wrong location. :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/985872163295741762-7258592840741043234?l=artoflinux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://artoflinux.blogspot.com/feeds/7258592840741043234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=985872163295741762&amp;postID=7258592840741043234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7258592840741043234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/985872163295741762/posts/default/7258592840741043234'/><link rel='alternate' type='text/html' href='http://artoflinux.blogspot.com/2008/02/coming-soon.html' title='Welcome to Art of Linux'/><author><name>Pratheesh Raymond M.J</name><uri>http://www.blogger.com/profile/06007078514236686245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_FUHqOT3f4kg/R7MjG1Q0H6I/AAAAAAAAAAc/FY7DGUyoW8U/S220/MB_E63-AMG_672_1024x768.jpg'/></author><thr:total>0</thr:total></entry></feed>
