<?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-2268593637883547236</id><updated>2012-02-16T17:31:18.579-08:00</updated><title type='text'>gnulogs.com</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default?start-index=101&amp;max-results=100'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>132</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-4976808623079783424</id><published>2011-07-25T07:02:00.000-07:00</published><updated>2011-07-25T07:03:11.398-07:00</updated><title type='text'>TCP , UDP ports and connections</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;TCP vs UDP&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:normal;mso-outline-level:4"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size:12.0pt; font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;; mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;Overview&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:12.0pt;line-height:normal"&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;TCP (Transmission Control Protocol) is the most commonly used protocol on the Internet. The reason for this is because TCP offers error correction. When the TCP protocol is used there is a "guaranteed delivery." This is due largely in part to a method called "flow control." Flow control determines when data needs to be re-sent, and stops the flow of data until previous packets are successfully transferred. This works because if a packet of data is sent, a collision may occur. When this happens, the client re-requests the packet from the server until the whole packet is complete and is identical to its original.&lt;br /&gt;&lt;br /&gt;UDP (User Datagram Protocol) is anther commonly used protocol on the Internet. However, UDP is never used to send important data such as webpages, database information, etc; UDP is commonly used for streaming audio and video. Streaming media such as Windows Media audio files (.WMA) , Real Player (.RM), and others use UDP because it offers speed! The reason UDP is faster than TCP is because there is no form of flow control or error correction. The data sent over the Internet is affected by collisions, and errors will be present. Remember that UDP is &lt;b&gt;only&lt;/b&gt; concerned with speed. This is the main reason why streaming media is not high quality.&lt;br /&gt; &lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt; &lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" align="center" style="margin-bottom:0in;margin-bottom:.0001pt; text-align:center;line-height:normal"&gt;&lt;span style="font-size:12.0pt;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;color:black;mso-no-proof:yes"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:formulas&gt;  &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;  &lt;o:lock ext="edit" aspectratio="t"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="Picture_x0020_4" spid="_x0000_i1028" type="#_x0000_t75" alt="Description: http://www.skullbox.net/udp.jpg" style="'width:375pt;"&gt;  &lt;v:imagedata src="file:///C:\Users\sylh\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" title="udp"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img width="500" height="300" src="file:///C:/Users/sylh/AppData/Local/Temp/msohtmlclip1/01/clip_image001.jpg" alt="Description: http://www.skullbox.net/udp.jpg" shapes="Picture_x0020_4" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;&lt;br /&gt;&lt;span style="mso-no-proof:yes"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="Picture_x0020_3" spid="_x0000_i1027" type="#_x0000_t75" alt="Description: http://www.skullbox.net/tcp.jpg" style="'width:375pt;height:225pt;visibility:visible;mso-wrap-style:square'"&gt;  &lt;v:imagedata src="file:///C:\Users\sylh\AppData\Local\Temp\msohtmlclip1\01\clip_image002.jpg" title="tcp"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img width="500" height="300" src="file:///C:/Users/sylh/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg" alt="Description: http://www.skullbox.net/tcp.jpg" shapes="Picture_x0020_3" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:12.0pt;line-height:normal"&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;&lt;br /&gt;&lt;br /&gt;On the contrary, UDP has been implemented among some trojan horse viruses. Hackers develop scripts and trojans to run over UDP in order to mask their activities. UDP packets are also used in DoS (Denial of Service) attacks. It is important to know the difference between TCP port 80 and UDP port 80. If you don't know what ports are go &lt;/span&gt;&lt;a href="http://www.skullbox.net/ports.php"&gt;&lt;span style="font-size:12.0pt; font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;; mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:#0000CC"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;. &lt;/span&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:normal;mso-outline-level:4"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size:12.0pt; font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;; mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;Frame Structure&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:12.0pt;line-height:normal"&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;As data moves along a network, various attributes are added to the file to create a &lt;i&gt;frame&lt;/i&gt;. This process is called &lt;i&gt;encapsulation&lt;/i&gt;. There are different methods of encapsulation depending on which protocol and &lt;/span&gt;&lt;a href="http://www.skullbox.net/ntoplogy.php"&gt;&lt;span style="font-size:12.0pt; font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;; mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:#0000CC"&gt;topology&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt; are being used. As a result, the frame structure of these packets differ as well. The images below show both the TCP and UDP frame structures. &lt;/span&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" align="center" style="mso-margin-top-alt:auto;mso-margin-bottom-alt: auto;text-align:center;line-height:normal;mso-outline-level:2"&gt;&lt;b&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;TCP FRAME STRUCTURE&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" align="center" style="margin-bottom:0in;margin-bottom:.0001pt; text-align:center;line-height:normal"&gt;&lt;span style="font-size:12.0pt;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;color:black;mso-no-proof:yes"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="Picture_x0020_2" spid="_x0000_i1026" type="#_x0000_t75" alt="Description: http://www.skullbox.net/diagrams/tcppacket.gif" style="'width:408pt;height:373.5pt;visibility:visible;mso-wrap-style:square'"&gt;  &lt;v:imagedata src="file:///C:\Users\sylh\AppData\Local\Temp\msohtmlclip1\01\clip_image003.gif" title="tcppacket"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img border="0" width="544" height="498" src="file:///C:/Users/sylh/AppData/Local/Temp/msohtmlclip1/01/clip_image003.gif" alt="Description: http://www.skullbox.net/diagrams/tcppacket.gif" shapes="Picture_x0020_2" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" align="center" style="mso-margin-top-alt:auto;mso-margin-bottom-alt: auto;text-align:center;line-height:normal;mso-outline-level:2"&gt;&lt;b&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;UDP FRAME STRUCTURE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" align="center" style="margin-bottom:0in;margin-bottom:.0001pt; text-align:center;line-height:normal"&gt;&lt;span style="font-size:12.0pt;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;color:black;mso-no-proof:yes"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="Picture_x0020_1" spid="_x0000_i1025" type="#_x0000_t75" alt="Description: http://www.skullbox.net/diagrams/udppacket.gif" style="'width:410.25pt;height:210pt;visibility:visible;mso-wrap-style:square'"&gt;  &lt;v:imagedata src="file:///C:\Users\sylh\AppData\Local\Temp\msohtmlclip1\01\clip_image004.gif" title="udppacket"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img border="0" width="547" height="280" src="file:///C:/Users/sylh/AppData/Local/Temp/msohtmlclip1/01/clip_image004.gif" alt="Description: http://www.skullbox.net/diagrams/udppacket.gif" shapes="Picture_x0020_1" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span style="font-size:12.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family:&amp;quot;Times New Roman&amp;quot;;color:black"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size:12.0pt;line-height:115%;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;mso-fareast-font-family:&amp;quot;Times New Roman&amp;quot;;mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;color:black"&gt;&lt;br /&gt;&lt;br /&gt;The &lt;i&gt;payload&lt;/i&gt; field contains the actually data. Notice that TCP has a more complex frame structure. This is largely due to the fact the TCP is a connection-oriented protocol. The extra fields are need to ensure the "guaranteed delivery" offered by TCP.&lt;/span&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="font-size:12.0pt;line-height:115%"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;&lt;span style="font-size:12.0pt;line-height:115%"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;&lt;span style="font-size:12.0pt;line-height:115%"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-4976808623079783424?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/4976808623079783424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=4976808623079783424' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4976808623079783424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4976808623079783424'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2011/07/tcp-udp-ports-and-connections.html' title='TCP , UDP ports and connections'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-681642463439121592</id><published>2011-03-21T13:08:00.001-07:00</published><updated>2011-03-21T13:08:20.573-07:00</updated><title type='text'>test</title><content type='html'>test&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-681642463439121592?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/681642463439121592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=681642463439121592' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/681642463439121592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/681642463439121592'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2011/03/test.html' title='test'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-5369524201243761125</id><published>2010-12-11T13:07:00.001-08:00</published><updated>2010-12-11T13:07:35.368-08:00</updated><title type='text'>Zombie and orphan</title><content type='html'>&lt;div&gt;&lt;div style="overflow: hidden; color: rgb(0, 0, 0); background-color: transparent; text-align: left; text-decoration: none; border: medium none;"&gt;&lt;p&gt;On  Unix operating systems, a zombie process or defunct process is a  process that has completed execution but still has an entry in the  process table, allowing the process that started it to read its exit  status. In the term's colorful metaphor, the child process has died but  has not yet been reaped. &lt;/p&gt;&lt;p&gt; When a process ends, all of the memory and resources associated with it  are deallocated so they can be used by other processes. However, the  process's entry in the process table remains. The parent is sent a  SIGCHLD signal indicating that a child has died; the handler for this  signal will typically execute the wait system call, which reads the exit  status and removes the zombie. The zombie's process ID and entry in the  process table can then be reused. However, if a parent ignores the  SIGCHLD, the zombie will be left in the process table. In some  situations this may be desirable, for example if the parent creates  another child process it ensures that it will not be allocated the same  process ID. &lt;/p&gt;&lt;p&gt; A zombie process is not the same as an orphan process. Orphan processes  don't become zombie processes; instead, they are adopted by init  (process ID 1), which waits on its children. &lt;/p&gt;&lt;p&gt; The term zombie process derives from the common definition of zombie�an undead person. &lt;/p&gt;&lt;p&gt; Zombies can be identified in the output from the Unix ps command by the  presence of a "Z" in the STAT column. Zombies that exist for more than a  short period of time typically indicate a bug in the parent program. As  with other leaks, the presence of a few zombies isn't worrisome in  itself, but may indicate a problem that would grow serious under heavier  loads. &lt;/p&gt;&lt;p&gt; To remove zombies from a system, the SIGCHLD signal can be sent to the  parent manually, using the kill command. If the parent process still  refuses to reap the zombie, the next step would be to remove the parent  process. When a process loses its parent, init becomes its new parent.  Init periodically executes the wait system call to reap any zombies with  init as parent. &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; An orphan process is a computer process whose parent process has finished or terminated. &lt;/p&gt;&lt;p&gt; A process can become orphaned during remote invocation when the client process crashes after making a request of the server. &lt;/p&gt;&lt;p&gt; Orphans waste server resources and can potentially leave a server in  trouble. However there are several solutions to the orphan process  problem: &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;    1. Extermination is the most commonly used technique; in this case the orphan process is killed. &lt;/p&gt;&lt;p&gt;    2. Reincarnation is a technique in which machines periodically try to  locate the parents of any remote computations; at which point orphaned  processes are killed. &lt;/p&gt;&lt;p&gt;    3. Expiration is a technique where each process is allotted a certain  amount of time to finish before being killed. If need be a process may  "ask" for more time to finish before the allotted time expires. &lt;/p&gt;&lt;p&gt; A process can also be orphaned running on the same machine as its parent  process. In a UNIX-like operating system any orphaned process will be  immediately adopted by the special "init" system process. This operation  is called re-parenting and occurs automatically. Even though  technically the process has the "init" process as its parent, it is  still called an orphan process since the process which originally  created it no longer exists.&lt;/p&gt;&lt;span&gt;&lt;br /&gt;&lt;a style="color: rgb(0, 51, 153);" href="http://wiki.answers.com/Q/What_is_Zombie_Process_and_Orphan_Process#ixzz17q6zxB4P"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-5369524201243761125?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/5369524201243761125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=5369524201243761125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5369524201243761125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5369524201243761125'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2010/12/zombie-and-orphan.html' title='Zombie and orphan'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6228523638366319443</id><published>2010-03-29T01:11:00.001-07:00</published><updated>2010-03-30T09:14:54.547-07:00</updated><title type='text'>Apache Tomcat Integration</title><content type='html'>Introduction tomcat and Apache web server&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Apache httpd is very fastest web server for static contents. Apache httpd web server has biggest market share of more than 60% in web server in world. Today apache httpd web server supports dynamic contents through module connectors. It supports php, cgi, perl and many more scripting languages. Apache is widely used in the world and it is freely available for download. It is open source code by apache projects. Apache's biggest advantage is platform independent, can work on any platform unix, linux and windows without any problems. Apache is not only platform independent, it is very easy to configure and very easy to use. Tomcat is another open source project from apache. Tomcat is java based web server, which support java servlet, and servlet side scripting. Java is platform independent and day by day getting popularity in market.&lt;br /&gt;&lt;br /&gt;Java has advantage of security and more secure than other programming languages. Servlet has advantage of precompiled and need not to compile on every request send by client on browser. All servlets and JSP runs under Java virtual machine. Tomcat is freely available from apache, and java is available from sun. Apache tomcat integration achieve through mod_jk connectors. It can communicate through AJP13 apache jserv protocol 13. This mo_jk connector interacts with tomcat web server and apache httpd, and send dynamic request to tomcat web server and response back to client. All static content handled by httpd server only. Let’s start integration of tomcat and apache step by step.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Installation of JDK in linux&lt;br /&gt;&lt;br /&gt;Tomcat doesn't run alone, it needs java runtime environment JRE or JVM for running jsp and servlet pages. JDK is freely available from sun. JDK can be downloaded from sun's website. http://java.sun.com/javase/downloads/index.jsp . Download latest version of jdk or sdk and install on the machine. Sun provides different versions of jdk for different platform. There are different versions available from sun for linux, windows or sun solaris. Tomcat 5.5 is work only with JDK 1.5 version, so use at least jdk 1.5 versions. Installing JDK on linux is not difficult work; this can be done by double click on bin format file or simple RPM. If you are installing JDK from rpm then you can run this command to install.&lt;br /&gt;rpm -ivh jdk-1_5_0_07-nb-5_0-linux-ml.rpm&lt;br /&gt;&lt;br /&gt;If you are installing JDK from bin file you can run this command to install, and also change permissions to 777 to bin file.&lt;br /&gt;sh jdk-1_5_0_07-nb-5_0-linux-ml.bin.&lt;br /&gt;&lt;br /&gt;JDK installed at default path /opt directory in linux fedora core 5.&lt;br /&gt;&lt;br /&gt;Installation Tomcat on linux&lt;br /&gt;see more Installing tomcat on Windows&lt;br /&gt;&lt;br /&gt;After successful installation of JDK, install tomcat. Tomcat is freely available from apache's website. Download latest version of tomcat from apache website. Tomcat is distributed in binary and source code. Binary code is precompiled of jar files and easy to install, and source code have to compile and install manually. Installation through source code need ant, this will compile automatically all files in sub directory or packages. Tomcat can be downloaded from http://archive.apache.org/dist/tomcat/tomcat-5/ Download tomcat in tar.gz format for Linux or any RPM form file and executable file or zipped file for windows platform. Unzip tar file&lt;br /&gt;tar -xvf apache-tomcat-5.5.17.tar.gz&lt;br /&gt;&lt;br /&gt;Copy this tomcat in root or anywhere. We used to install tomcat at root / in linux.&lt;br /&gt;&lt;br /&gt;Tomcat need to know where is java installed on system, where to compile servlets and beans. Now set environment variables for java, jre and classpath for servlet-api. This can be done by export command manully. Export will keep environment setting until system is not shutdown or restarted. When system get restarted all environment setting will lost.&lt;br /&gt;export JAVA_HOME=/opt/jdk&lt;br /&gt;&lt;br /&gt;or we can call this automatically by putting export command in startup.sh script and shutdown.sh script of tomcat. This can be done easily, open startup.sh file in vi or any text editor from %TOMCAT_HOME%/bin/startup.sh /opt/jdk is folder where actual java is installed. Or specify the java home directory path&lt;br /&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;# -----------------------------------------------------------------------------&lt;br /&gt;# Start Script for the CATALINA Server&lt;br /&gt;#&lt;br /&gt;# $Id: startup.sh 385888 2006-03-14 21:04:40Z keith $&lt;br /&gt;# -----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;# Better OS/400 detection: see Bugzilla 31132&lt;br /&gt;export JAVA_HOME=/opt/jdk/&lt;br /&gt;os400=false&lt;br /&gt;darwin=false&lt;br /&gt;case "`uname`" in&lt;br /&gt;CYGWIN*) cygwin=true;;&lt;br /&gt;OS400*) os400=true;;&lt;br /&gt;Darwin*) darwin=true;;&lt;br /&gt;esac&lt;br /&gt;&lt;br /&gt;# resolve links - $0 may be a softlink&lt;br /&gt;PRG="$0"&lt;br /&gt;&lt;br /&gt;while [ -h "$PRG" ] ; do&lt;br /&gt;ls=`ls -ld "$PRG"`&lt;br /&gt;link=`expr "$ls" : '.*-&gt; \(.*\)$'`&lt;br /&gt;if expr "$link" : '/.*' &gt; /dev/null; then&lt;br /&gt;  PRG="$link"&lt;br /&gt;else&lt;br /&gt;  PRG=`dirname "$PRG"`/"$link"&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;It should be also defined in shutdown.sh script of tomcat. Open shutdown.sh script in any text editor, and include export command in shutdown.sh script.&lt;br /&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;# -----------------------------------------------------------------------------&lt;br /&gt;# Stop script for the CATALINA Server&lt;br /&gt;#&lt;br /&gt;# $Id: shutdown.sh 385888 2006-03-14 21:04:40Z keith $&lt;br /&gt;# -----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;# resolve links - $0 may be a softlink&lt;br /&gt;export JAVA_HOME=/opt/jdk&lt;br /&gt;PRG="$0"&lt;br /&gt;&lt;br /&gt;while [ -h "$PRG" ] ; do&lt;br /&gt;ls=`ls -ld "$PRG"`&lt;br /&gt;link=`expr "$ls" : '.*-&gt; \(.*\)$'`&lt;br /&gt;if expr "$link" : '/.*' &gt; /dev/null; then&lt;br /&gt;  PRG="$link"&lt;br /&gt;else&lt;br /&gt;  PRG=`dirname "$PRG"`/"$link"&lt;br /&gt;fi&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;PRGDIR=`dirname "$PRG"`&lt;br /&gt;EXECUTABLE=catalina.sh&lt;br /&gt;&lt;br /&gt;# Check that target executable exists&lt;br /&gt;if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then&lt;br /&gt;echo "Cannot find $PRGDIR/$EXECUTABLE"&lt;br /&gt;echo "This file is needed to run this program"&lt;br /&gt;exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;exec "$PRGDIR"/"$EXECUTABLE" stop "$@"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Test tomcat is installed properly. Run this command to startup tomcat through linux terminal.&lt;br /&gt;&lt;br /&gt;%TOMCAT_HOME%/bin/startup.sh&lt;br /&gt;&lt;br /&gt;e.g. /tomcatA/bin/startup.sh&lt;br /&gt;&lt;br /&gt;And shutdown&lt;br /&gt;&lt;br /&gt;%TOMCAT_HOME%/bin/shutdown.sh&lt;br /&gt;&lt;br /&gt;e.g. /tomcatA/bin/shutdown.sh&lt;br /&gt;&lt;br /&gt;If tomcat is throwing error, check logs folder %TOMCAT_HOME%/logs/catalina.out. If your tomcat does not have logs folder make it manually and restart tomcat again.&lt;br /&gt;&lt;br /&gt;Open web browser and in address bar write http://localhost:8080/. If it opens apache's page, means tomcat is working properly.&lt;br /&gt;&lt;br /&gt;Now you need to configure servlets and application context path. Servlet invoker is default invoker to load servlet into tomcat memory. No need to describe, any parameters in web.xml. Servlet and port configuration setting go through Servlet invoker&lt;br /&gt;Apache installation&lt;br /&gt;&lt;br /&gt;see more Installing Apache on Windows&lt;br /&gt;&lt;br /&gt;Apache httpd also open source project by apache group. Apache easily available from http://archive.apache.org/dist/httpd/ . Download stable tar.gz versions of apache httpd. Apache httpd 2.0 more stable version then other versions.&lt;br /&gt;&lt;br /&gt;First you have to remove previous installed httpd from your system. Otherwise it will conflict with new installed httpd services.&lt;br /&gt;&lt;br /&gt;Commands to remove default rpm of httpd(apache).&lt;br /&gt;&lt;br /&gt;Find your installed rpm packages in system by&lt;br /&gt;rpm -qa | grep -i httpd&lt;br /&gt;&lt;br /&gt;uninstall rpm&lt;br /&gt;rpm -e packageName&lt;br /&gt;&lt;br /&gt;e.g. rpm -e httpd-2.2.0-5.1.2&lt;br /&gt;Uncompress downloaded httpd-2.0.55.tar.gz by tar command&lt;br /&gt;tar -xvf httpd-2.0.55.tar.gz&lt;br /&gt;&lt;br /&gt;Command to install apache manually.&lt;br /&gt;Go in directory where apache is unzipped&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[root@clustering ~] cd /httpd&lt;br /&gt;[root@ clustering httpd]./configure --prefix=/usr/local/httpd&lt;br /&gt;[root@ clustering httpd]make&lt;br /&gt;[root@ clustering httpd] make install&lt;br /&gt;&lt;br /&gt;Apache is now installed if in last it doesn't show any error.&lt;br /&gt;Test apache by starting apache&lt;br /&gt;[root@ clustering httpd] /usr/local/httpd/bin/apachect1 start&lt;br /&gt;&lt;br /&gt;If it is started correctly you can check it on browser by opening localhost address bar.&lt;br /&gt;Mod_jk Connector&lt;br /&gt;&lt;br /&gt;This is very important step of tomcat apache integration. Mod_jk is connector module which helps to make connection between tomcat and apache web server. The request come from apache and apache web server send this request to tomcat web server through mod_jk. There are two type of mod_jk available&lt;br /&gt;&lt;br /&gt; 1. mod_jk.so module&lt;br /&gt; 2. mod_jk2.so module&lt;br /&gt;&lt;br /&gt;mod_jk2.so's development is stopped. So we are using mod_jk.so module. This can be downloaded from http://archive.apache.org/dist/jakarta/tomcat-connectors/.&lt;br /&gt;Download binary format module.&lt;br /&gt;Copy mok_jk.so module in modules directory of apache web server&lt;br /&gt;e.g. C:\apache\Apache2\modules&lt;br /&gt;or in linux&lt;br /&gt;&lt;br /&gt;e.g. /usr/local/httpd/modules&lt;br /&gt;Configuration Tomcat and Apache&lt;br /&gt;&lt;br /&gt;Apache Tomcat Configuration, Apache web server use a configuration file, httpd.conf. This file is in folder&lt;br /&gt;&lt;br /&gt;/usr/local/httpd/conf/httpd.conf&lt;br /&gt;&lt;br /&gt;Or %httpd%/conf/httpd.conf. Open this file in any text editor notepad or vi editor and do editing as show in this file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Listen 80&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# Dynamic Shared Object (DSO) Support&lt;br /&gt;#&lt;br /&gt;# To be able to use the functionality of a module which was built as a DSO you&lt;br /&gt;# have to place corresponding `LoadModule' lines at this location so the&lt;br /&gt;# directives contained in it are actually available _before_ they are used.&lt;br /&gt;# Statically compiled modules (those listed by `httpd -l') do not need&lt;br /&gt;# to be loaded here.&lt;br /&gt;#&lt;br /&gt;# Example:&lt;br /&gt;# LoadModule foo_module modules/mod_foo.so&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;LoadModule jk_module modules/mod_jk.so&lt;br /&gt;JkWorkersFile /usr/local/httpd/conf/workers.properties&lt;br /&gt;JkLogFile "logs/mod_jk.log"&lt;br /&gt;JkLogLevel error&lt;br /&gt;JkMount /gnulogsbox loadbalancer&lt;br /&gt;JkMount /gnulogsbox/* loadbalancer&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# ExtendedStatus controls whether Apache will generate "full" status&lt;br /&gt;# information (ExtendedStatus On) or just basic information (ExtendedStatus&lt;br /&gt;# Off) when the "server-status" handler is called. The default is Off.&lt;br /&gt;#&lt;br /&gt;#ExtendedStatus On&lt;br /&gt;&lt;br /&gt;### Section 2: 'Main' server configuration&lt;br /&gt;#&lt;br /&gt;# The directives in this section set up the values used by the 'main'&lt;br /&gt;# server, which responds to any requests that aren't handled by a&lt;br /&gt;# &lt;virtualhost&gt; definition.  These values also provide defaults for&lt;br /&gt;# any &lt;virtualhost&gt; containers you may define later in the file.&lt;br /&gt;#&lt;br /&gt;# All of these directives may appear inside &lt;virtualhost&gt; containers,&lt;br /&gt;# in which case these default settings will be overridden for the&lt;br /&gt;# virtual host being defined.&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;&lt;ifmodule&gt;&lt;br /&gt;&lt;ifmodule&gt;&lt;br /&gt;#&lt;br /&gt;# If you wish httpd to run as a different user or group, you must run&lt;br /&gt;# httpd as root initially and it will switch.&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;Add this highlighted line in httpd.conf file. Create a file in /usr/local/httpd/log/ mod_jk.log. This log file refers to error thrown by apache web server. Errors can be read from this log file.&lt;br /&gt;&lt;br /&gt;Create new file in /usr/local/httpd/conf/workers.properties. This workers.properties file contains all information about workers (Tomcat), their ports connector Port AJP apache javaserv port. A sample file is given here.&lt;br /&gt;&lt;br /&gt;workers.tomcat_home=/tomcat&lt;br /&gt;workers.java_home=$JAVA_HOME&lt;br /&gt;ps=/&lt;br /&gt;worker.list=tomcat,loadbalancer&lt;br /&gt;&lt;br /&gt;worker.tomcat.port=8009&lt;br /&gt;worker.tomcat.host=192.168.1.80&lt;br /&gt;worker.tomcat.type=ajp13&lt;br /&gt;worker.tomcat.lbfactor=1&lt;br /&gt;&lt;br /&gt;worker.loadbalancer.type=lb&lt;br /&gt;worker.loadbalancer.balanced_workers=tomcat&lt;br /&gt;worker.loadbalancer.sticky_session=1&lt;br /&gt;&lt;br /&gt;Worker.tomcat.host=192.168.1.80 is tomcat server ipaddress or use computer name instead of ipaddress like this&lt;br /&gt;&lt;br /&gt;Worker.tomcat.host=&lt;/ifmodule&gt;&lt;/ifmodule&gt;&lt;/virtualhost&gt;&lt;/virtualhost&gt;&lt;/virtualhost&gt;gnulogsbox&lt;virtualhost&gt;&lt;virtualhost&gt;&lt;virtualhost&gt;&lt;ifmodule&gt;&lt;ifmodule&gt;.&lt;br /&gt;&lt;br /&gt;Now It is almost done. Just stop apache web server and again start. To start apache web server manually, should use command.&lt;br /&gt;[root@ clustering httpd] /usr/local/httpd/bin/apachect1 stop&lt;br /&gt;&lt;br /&gt;And start apache web server now&lt;br /&gt;[root@ clustering httpd] /usr/local/httpd/bin/apachect1 start&lt;br /&gt;&lt;br /&gt;If apache starts again without error, this means all things are going in right way. If apache doesn't start and throw an error then you need to change mod_jk.so connector according to your server hardware configuration. Download another mod_jk connector and again copy to module folder and stop and start apache httpd server. Otherwise, again and again find suitable connector for your hardware and server configuration, test it again apache. Error may be this kind of&lt;br /&gt;&lt;br /&gt;[root@clustering httpd]# /usr/local/httpd/bin/apachectl start&lt;br /&gt;Syntax error on line 234 of /usr/local/httpd/conf/httpd.conf:&lt;br /&gt;Cannot load /usr/local/httpd/modules/mod_jk.so into server: /usr/local/httpd/modules/mod_jk.so: invalid ELF header&lt;br /&gt;&lt;br /&gt;When apache httpd server start without any error,&lt;br /&gt;&lt;br /&gt;[root@clustering httpd]# /usr/local/httpd/bin/apachectl start&lt;br /&gt;httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName&lt;br /&gt;&lt;br /&gt;This is error free startup of apache.&lt;br /&gt;Run Jsp and servlet&lt;br /&gt;&lt;br /&gt;Now start tomcat server. After startup of tomcat server, you can test simple jsp page. http://192.168.1.80/ this will open apache home page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ifmodule&gt;&lt;/ifmodule&gt;&lt;/virtualhost&gt;&lt;/virtualhost&gt;&lt;/virtualhost&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6228523638366319443?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6228523638366319443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6228523638366319443' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6228523638366319443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6228523638366319443'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2010/03/apache-tomcat-integration.html' title='Apache Tomcat Integration'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-8556295045658387755</id><published>2009-12-13T03:47:00.000-08:00</published><updated>2009-12-13T03:54:57.747-08:00</updated><title type='text'>1. What is a SAN?</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_7kkNOFq7H1o/SyTWAerYPYI/AAAAAAAAAI4/XDB2MUwZl9c/s1600-h/BEXFibreChannelLoop.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 272px;" src="http://4.bp.blogspot.com/_7kkNOFq7H1o/SyTWAerYPYI/AAAAAAAAAI4/XDB2MUwZl9c/s320/BEXFibreChannelLoop.gif" alt="" id="BLOGGER_PHOTO_ID_5414687955729530242" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;img src="file:///C:/DOCUME%7E1/Owner/LOCALS%7E1/Temp/moz-screenshot-2.png" alt="" /&gt;&lt;br /&gt;1. What is a SAN?&lt;br /&gt;A SAN, or storage area network, is a dedicated network that is separate from LANs&lt;br /&gt;and WANs. It generally serves to interconnect the storage-related resources that are&lt;br /&gt;connected to one or more servers. It is often characterized by its high interconnection&lt;br /&gt;data rates (Gigabits/sec) between member storage peripherals and by its highly&lt;br /&gt;scalable architecture. Though typically spoken of in terms of hardware, SANs very&lt;br /&gt;often include specialized software for their management, monitoring and&lt;br /&gt;configuration.&lt;br /&gt;SANs can provide many benefits. Centralizing data storage operations and their&lt;br /&gt;management is certainly one of the chief reasons that SANs are being specified and&lt;br /&gt;developed today. Administrating all the storage resources in high-growth and&lt;br /&gt;mission-critical environments can be daunting and very expensive. SANs can&lt;br /&gt;dramatically reduce the management costs and complexity of these environments&lt;br /&gt;while providing significant technical advantages.&lt;br /&gt;SANs can be based upon several different types of high-speed interfaces. In fact,&lt;br /&gt;many SANs today use a combination of different interfaces. Currently, Fibre Channel&lt;br /&gt;serves as the de facto standard being used in most SANs. Fibre Channel is an&lt;br /&gt;industry-standard interconnect and high-performance serial I/O protocol that is media&lt;br /&gt;independent and supports simultaneous transfer of many different protocols.&lt;br /&gt;Additionally, SCSI interfaces are frequently used as sub-interfaces between internal&lt;br /&gt;components of SAN members, such as between raw storage disks and a RAID&lt;br /&gt;controller.&lt;br /&gt;MSKL SAN Tutorial&lt;br /&gt;Provding large increases in storage performance, state-of-the-art reliability and&lt;br /&gt;scalability are primary SAN benefits. Storage performance of a SAN can be much&lt;br /&gt;higher than traditional direct attached storage, largely because of the very high data&lt;br /&gt;transfer rates of the electrical interfaces used to connect devices in a SAN (such as&lt;br /&gt;Fibre Channel). Additionally, performance gains can come from opportunities&lt;br /&gt;provided by a SAN’s flexible architecture, such as load balancing and LAN-free&lt;br /&gt;backup. Even storage reliability can be greatly enhanced by special features made&lt;br /&gt;possible within a SAN. Options like redundant I/O paths, server clustering, and runtime&lt;br /&gt;data replication (local and/or remote) can ensure data and application&lt;br /&gt;availability. Adding storage capacity and other storage resources can be&lt;br /&gt;accomplished easily within a SAN, often without the need to shut down or even&lt;br /&gt;quiese the server(s) or their client networks. These features can quickly add up to&lt;br /&gt;large cost savings, fewer network outages, painless storage expansion, and reduced&lt;br /&gt;network loading.&lt;br /&gt;By providing these dedicated and “very high speed” networks for storage and backup&lt;br /&gt;operations. SANs can quickly justify their implementation. Offloading tasks, such as&lt;br /&gt;backup, from LANs and WANs is vital in today’s IT environments where networks&lt;br /&gt;loads and bandwidth availability are critical metrics by which organizations measure&lt;br /&gt;their own performance and even profits. Backup windows have shrunken dramatically&lt;br /&gt;and some environments have no backup windows at all since entire data networks&lt;br /&gt;and applications often require 24x365 availability.&lt;br /&gt;As with many IT technologies, SANs depend on new and developing standards to&lt;br /&gt;ensure seamless interoperability between their member components. SAN hardware&lt;br /&gt;components such as Fibre Channel hubs, switches, host bus adapters, bridges and&lt;br /&gt;RAID storage systems rely on many adopted standards for their connectivity. SAN&lt;br /&gt;software, every bit as important its hardware, often provides many of the features and&lt;br /&gt;benefits that SANs have come to be known for. SAN software can provide or enable&lt;br /&gt;foundation features and capabilities, including:&lt;br /&gt;·  SAN Management&lt;br /&gt;·  SAN Monitoring (including “phone home” notification features)&lt;br /&gt;·  SAN Configuration&lt;br /&gt;·  Redundant I/O Path Management&lt;br /&gt;·  LUN Masking and Assignment&lt;br /&gt;·  Serverless Backup&lt;br /&gt;·  Data Replication (both local and remote)&lt;br /&gt;·  Shared Storage (including support for heterogeneous platform environments)&lt;br /&gt;&lt;br /&gt;to be cntnd..&lt;img src="file:///C:/DOCUME%7E1/Owner/LOCALS%7E1/Temp/moz-screenshot.png" alt="" /&gt;&lt;img src="file:///C:/DOCUME%7E1/Owner/LOCALS%7E1/Temp/moz-screenshot-1.png" alt="" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-8556295045658387755?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/8556295045658387755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=8556295045658387755' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/8556295045658387755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/8556295045658387755'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/12/1-what-is-san.html' title='1. What is a SAN?'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7kkNOFq7H1o/SyTWAerYPYI/AAAAAAAAAI4/XDB2MUwZl9c/s72-c/BEXFibreChannelLoop.gif' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6029346332897841122</id><published>2009-07-15T06:38:00.000-07:00</published><updated>2009-07-15T06:42:48.215-07:00</updated><title type='text'>Apache Performance Tuning</title><content type='html'>&lt;h1&gt;Apache Performance Tuning&lt;/h1&gt;&lt;br /&gt;&lt;h2&gt;General&lt;br /&gt;&lt;/h2&gt;  &lt;h4&gt;RAM&lt;/h4&gt; &lt;p&gt;The single biggest issue affecting webserver performance is RAM. Have as much RAM as your hardware, OS, and funds allow [within reason].&lt;/p&gt;  &lt;p&gt;The more RAM your system has, the more processes [and threads] Apache can allocate and use; which directly translates into the amount of concurrent requests/clients Apache can serve.&lt;/p&gt;  &lt;p&gt;Generally speaking, disk I/O is usually a close 2nd, followed by CPU speed and network link. Note that a single PII 400 Mhz with 128-256 Megs of RAM can saturate a T3 (45 Mbps) line.&lt;/p&gt;   &lt;h4&gt;Select MPM&lt;/h4&gt;  &lt;p&gt;Chose the right MPM for the right job:&lt;/p&gt;  &lt;h5&gt;prefork [default MPM for Apache 2.0 and 1.3]:&lt;/h5&gt; &lt;ul&gt;&lt;li&gt;Apache 1.3-based.&lt;/li&gt;&lt;li&gt;Multiple processes, 1 thread per process, processes handle requests.&lt;/li&gt;&lt;li&gt;Used for security and stability.&lt;/li&gt;&lt;li&gt;Has higher memory consumption and lower performance over the newer Apache 2.0-based threaded MPMs.&lt;/li&gt;&lt;/ul&gt;  &lt;h5&gt;worker:&lt;/h5&gt; &lt;ul&gt;&lt;li&gt;Apache 2.0-based.&lt;/li&gt;&lt;li&gt;Multiple processes, many threads per process, threads handle requests.&lt;/li&gt;&lt;li&gt;Used for lower memory consumption and higher performance.&lt;/li&gt;&lt;li&gt;Does not provide the same level of isolation request-to-request, as a process-based MPM does.&lt;/li&gt;&lt;/ul&gt;  &lt;h5&gt;winnt:&lt;/h5&gt; &lt;ul&gt;&lt;li&gt;The only MPM choice under Windows.&lt;/li&gt;&lt;li&gt;1 parent process, exactly 1 child process with many threads, threads handle requests.&lt;/li&gt;&lt;li&gt;Best solution under Windows, as on this platform, threads are always "cheaper" to use over processes.&lt;/li&gt;&lt;/ul&gt;   &lt;h4&gt;Configure MPM&lt;/h4&gt;  Core Features and Multi-Processing Modules  &lt;h5&gt;Default Configuration&lt;/h5&gt;  &lt;pre&gt;&lt;ifmodule&gt;&lt;br /&gt;StartServers            8&lt;br /&gt;MinSpareServers         5&lt;br /&gt;MaxSpareServers        20&lt;br /&gt;MaxClients            150&lt;br /&gt;MaxRequestsPerChild  1000&lt;br /&gt;&lt;/ifmodule&gt;&lt;br /&gt;&lt;br /&gt;&lt;ifmodule&gt;&lt;br /&gt;StartServers            2&lt;br /&gt;MaxClients            150&lt;br /&gt;MinSpareThreads        25&lt;br /&gt;MaxSpareThreads        75&lt;br /&gt;ThreadsPerChild        25&lt;br /&gt;MaxRequestsPerChild     0&lt;br /&gt;&lt;/ifmodule&gt;&lt;br /&gt;&lt;br /&gt;&lt;ifmodule&gt;&lt;br /&gt;ThreadsPerChild       250&lt;br /&gt;MaxRequestsPerChild     0&lt;br /&gt;&lt;/ifmodule&gt;&lt;br /&gt;&lt;/pre&gt;  &lt;h5&gt;Directives&lt;/h5&gt;  &lt;h6&gt;MaxClients, for prefork MPM&lt;/h6&gt;  &lt;p&gt;MaxClients sets a limit on the number of simultaneous connections/requests that will be served.&lt;/p&gt;  &lt;p&gt;I consider this directive to be the critical factor to a well functioning server. Set this number too low and resources will go to waste. Set this number too high and an influx of connections will bring the server to a stand still. Set this number just right and your server will fully utilize the available resources.&lt;/p&gt;  &lt;p&gt;An &lt;em&gt;approximation&lt;/em&gt; of this number should be derived by dividing the amount of system memory (physical RAM) available by the maximum size of an apache/httpd process; with a generous amount spared for all other processes.&lt;/p&gt;  &lt;samp&gt;MaxClients ≈ (RAM - size_all_other_processes)/(size_apache_process)&lt;/samp&gt;  &lt;p&gt;Use 'ps -ylC httpd --sort:rss' to find process size. Divide number by 1024 to get megabytes. Also try 'top'.&lt;/p&gt; &lt;p&gt;Use 'free -m' for a general overview. The key figure to look at is the buffers/cache used value.&lt;/p&gt; &lt;p&gt;Use 'vmstat 2 5' to display the number of runnable, blocked, and waiting processes; and swap in and swap out.&lt;/p&gt;  &lt;p&gt;Example:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;System: VPS (Virtual Private Server), CentOS 4.4, with 128MB RAM&lt;/li&gt;&lt;li&gt;Apache: v2.0, mpm_prefork, mod_php, mod_rewrite, mod_ssl, and other modules&lt;/li&gt;&lt;li&gt;Other Services: MySQL, Bind, SendMail&lt;/li&gt;&lt;li&gt;Reported System Memory: 120MB&lt;/li&gt;&lt;li&gt;Reported httpd process size: 7-13MB&lt;/li&gt;&lt;li&gt;Assumed memory available to Apache: 90MB&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;Optimal settings:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;StartServers 5&lt;/li&gt;&lt;li&gt;MinSpareServers 5&lt;/li&gt;&lt;li&gt;MaxSpareServers 10&lt;/li&gt;&lt;li&gt;ServerLimit 15&lt;/li&gt;&lt;li&gt;MaxClients 15&lt;/li&gt;&lt;li&gt;MaxRequestsPerChild 2000&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;With the above configuration, we start with 5-10 processes and set a top limit of 15. Anything above this number will cause serious swapping and thrashing under a load; due to the low amount of RAM available to the [virtual] Server. With a dedicated Server, the default values [ServerLimit 256] will work with 1-2GB of RAM.&lt;/p&gt;  &lt;p&gt;When calculating MaxClients, take into consideration that the reported size of a process and the effective size are two different values. In this setup, it might be safe to use 20 or more workers... Play with different values and check your system stats.&lt;/p&gt;  &lt;p&gt;Note that when more connections are attempted than there are workers, the connections are placed into a queue. The default queue size value is 511 and can be adjusted with the ListenBackLog directive.&lt;/p&gt;  &lt;h6&gt;ThreadsPerChild, for winnt MPM&lt;/h6&gt;  &lt;p&gt;On the Windows side, the only useful directive is ThreadsPerChild, which is usually set to a value of 250 [defaults to 64 without a value]. If you expect more, or less, concurrent connections/requests, set this directive appropriately. Check process size with Task Manager, under different values and server load.&lt;/p&gt;  &lt;h6&gt;MaxRequestsPerChild&lt;/h6&gt;  &lt;p&gt;Directive MaxRequestsPerChild is used to recycle processes. When this directive is set to 0, an unlimited amount of requests are allowed per process.&lt;/p&gt;  &lt;p&gt;While some might argue that this increases server performance by not burdening Apache with having to destroy and create new processes, there is the other side to the argument...&lt;/p&gt;  &lt;p&gt;Setting this value to the amount of requests that a website generates per day, divided by the number of processes, will have the benefit of keeping memory leaks and process bloat to a minimum [both of which &lt;strong&gt;are&lt;/strong&gt; a common problem]. The goal here is to recycle each process once per day, as apache threads gradually increase their memory allocation as they run.&lt;/p&gt;  &lt;p&gt;Note that under the winnt MPM model, recycling the only request serving process that Apache contains, can present a problem for some sites with constant and heavy traffic.&lt;/p&gt;  &lt;h5&gt;Requests vs. Client Connections&lt;/h5&gt;  &lt;p&gt;On any given connection, to load a page, a client may request many URLs: page, site css files, javascript files, image files, etc.&lt;/p&gt;  &lt;p&gt;Multiple requests from one client in rapid succession can have the same effect on a Server as "concurrent" connections [threaded MPMs and directive KeepAlive taken into consideration]. If a particular website requires 10 requests per page, 10 concurrent clients will require MPM settings that are geared more towards 20-70 clients. This issue manifests itself most under a process-based MPM [prefork].&lt;/p&gt;   &lt;h4&gt;Separate Static and Dynamic Content&lt;/h4&gt; &lt;p&gt;Use separate servers for static and dynamic content. Apache processes serving dynamic content will carry overhead and swell to the size of the content being served, never decreasing in size. Each process will incur the size of any loaded PHP or Perl libraries. A 6MB-30MB process size [or 10% of server's memory] is not unusual, and becomes a waist of resources for serving static content.&lt;/p&gt;  &lt;p&gt;For a more efficient use of system memory, either use mod_proxy to pass specific requests onto another Apache Server, or use a lightweight server to handle static requests:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;lighttpd [has experimental win32 builds]&lt;/li&gt;&lt;li&gt;tux [patched into RedHat, runs inside the Linux kernel and is at the top of the charts in performance]&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;The Server handling the static content goes up front.&lt;/p&gt;  &lt;p&gt;Note that configuration settings will be quite different between a dynamic content Server and a static content Server.&lt;/p&gt;   &lt;h4&gt;mod_deflate&lt;/h4&gt; &lt;p&gt;Reduce bandwidth by 75% and improve response time by using mod_deflate.&lt;/p&gt; &lt;code&gt; LoadModule deflate_module modules/mod_deflate.so&lt;br /&gt;&lt;location&gt;&lt;br /&gt;AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/x-javascript&lt;br /&gt;&lt;/location&gt; &lt;/code&gt;  &lt;h4&gt;Loaded Modules&lt;/h4&gt; &lt;p&gt;Reduce memory footprint by loading only the required modules.&lt;/p&gt;  &lt;p&gt;Some also advise to statically compile in the needed modules, over building DSOs (Dynamic Shared Objects). &lt;strong&gt;Very bad advice.&lt;/strong&gt; You will need to manually rebuild Apache every time a new version or security advisory for a module is put out, creating more work, more build related headaches, and more downtime.&lt;/p&gt;  &lt;h4&gt;mod_expires&lt;/h4&gt; &lt;p&gt;Include mod_expires for the ability to set expiration dates for specific content; utilizing the 'If-Modified-Since' header cache control sent by the user's browser/proxy. Will save bandwidth and drastically speed up your site for [repeat] visitors.&lt;/p&gt;  &lt;p&gt;Note that this can also be implemented with mod_headers.&lt;/p&gt;   &lt;h4&gt;KeepAlive&lt;/h4&gt; &lt;p&gt;Enable HTTP persistent connections to improve latency times and reduce server load significantly [25% of original load is not uncommon].&lt;/p&gt;  &lt;p&gt;prefork MPM:&lt;/p&gt; &lt;code&gt; KeepAlive On&lt;br /&gt;KeepAliveTimeout 2&lt;br /&gt;MaxKeepAliveRequests 80 &lt;/code&gt;  &lt;p&gt;worker and winnt MPMs:&lt;/p&gt; &lt;code&gt; KeepAlive On&lt;br /&gt;KeepAliveTimeout 15&lt;br /&gt;MaxKeepAliveRequests 80 &lt;/code&gt;  &lt;p&gt;With the prefork MPM, it is recommended to set 'KeepAlive' to 'Off'. Otherwise, a client will tie up an entire process for that span of time. Though in my experience, it is more useful to simply set the 'KeepAliveTimeout' value to something very low [2 seconds seems to be the ideal value]. This is not a problem with the worker MPM [thread-based], or under Windows [which only has the thread-based winnt MPM].&lt;/p&gt;  &lt;p&gt;With the worker and winnt MPMs, the default 15 second timeout is setup to keep the connection open for the next page request; to better handle a client going from link to link. Check logs to see how long a client remains on each page before moving on to another link. Set value appropriately [do not set higher than 60 seconds].&lt;/p&gt;  &lt;h4&gt;SymLinks&lt;/h4&gt; &lt;p&gt;Make sure 'Options +FollowSymLinks -SymLinksIfOwnerMatch' is set for all directories. Otherwise, Apache will issue an extra system call per filename component to substantiate that the filename is NOT a symlink; and more system calls to match an owner.&lt;/p&gt; &lt;code&gt; &lt;directory&gt;&lt;br /&gt;Options FollowSymLinks&lt;br /&gt;&lt;/directory&gt; &lt;/code&gt;  &lt;h4&gt;AllowOverride&lt;/h4&gt; &lt;p&gt;Set a default 'AllowOverride None' for your filesystem. Otherwise, for a given URL to path translation, Apache will attempt to detect an .htaccess file under every directory level of the given path.&lt;/p&gt; &lt;code&gt; &lt;directory&gt;&lt;br /&gt;AllowOverride None&lt;br /&gt;&lt;/directory&gt; &lt;/code&gt;  &lt;h4&gt;ExtendedStatus&lt;/h4&gt; &lt;p&gt;If mod_status is included, make sure that directive 'ExtendedStatus' is set to 'Off'. Otherwise, Apache will issue several extra time-related system calls on every request made.&lt;/p&gt; &lt;code&gt; ExtendedStatus Off &lt;/code&gt;  &lt;h4&gt;Timeout&lt;/h4&gt; &lt;p&gt;Lower the amount of time the server will wait before failing a request.&lt;/p&gt; &lt;code&gt;Timeout 45&lt;/code&gt;   &lt;h2&gt;Other/Specific&lt;/h2&gt;  &lt;p&gt;Cache all PHP pages, using Squid, and/or a PHP Accelerator and Encoder application, such as APC. Also take a look at mod_cache under Apache 2.2.&lt;/p&gt;  &lt;p&gt;Convert/pre-render all PHP pages that do not change request-to-request, to static HTML pages. Use 'wget' or 'HTTrack' to crawl your site and perform this task automatically.&lt;/p&gt;  &lt;p&gt;Pre-compress content and pre-generate headers for static pages; send-as-is using mod_asis. Can use 'wget' or 'HTTrack' for this task. Make sure to set zlib Compression Level to a high value (6-9). This will take a considerable amount of load off the server.&lt;/p&gt;  &lt;p&gt;Use output buffering under PHP to generate output and serve requests without pauses.&lt;/p&gt;  &lt;p&gt;Avoid content negotiation for faster response times.&lt;/p&gt;  &lt;p&gt;Make sure log files are being rotated. Apache will not handle large (2gb+) files very well.&lt;/p&gt;  &lt;p&gt;Gain a significant performance improvement by using &lt;span style="font-weight: bold;"&gt;SSL session cache&lt;/span&gt;.&lt;/p&gt;  &lt;p&gt;Outsource your images to Amazon's Simple Storage Service (S3).&lt;/p&gt;   &lt;h2&gt;Measuring Web Server Performance&lt;/h2&gt; &lt;h4&gt;Load Testing&lt;/h4&gt; Apache HTTP server benchmarking tool&lt;br /&gt;httperf&lt;br /&gt;The Grinder, a Java Load Testing Framework  &lt;h4&gt;Benchmarks&lt;/h4&gt;  &lt;p&gt;I have searched extensively for Apache, lighttpd, tux, and other webserver benchmarks. Sadly, just about every single benchmark I could locate appeared to have been performed completely without thought, or with great bias.&lt;/p&gt;  &lt;p&gt;Do not trust any posted benchmarks, especially ones done with the 'ab' tool.&lt;/p&gt;  &lt;p&gt;The only way to get a valid report is to perform the benchmark yourself.&lt;/p&gt;  &lt;p&gt;For valid results, note to test under a system with limited resources, and maximum resources. But most importantly, configure each httpd server application for the specific situation.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6029346332897841122?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6029346332897841122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6029346332897841122' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6029346332897841122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6029346332897841122'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/07/apache-performance-tuning-general-ram.html' title='Apache Performance Tuning'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3656063071472193421</id><published>2009-06-27T20:54:00.001-07:00</published><updated>2009-06-27T20:54:51.609-07:00</updated><title type='text'>DAG repo to yum</title><content type='html'>&lt;span class="postbody"&gt;You can make yum more robust by adding more repositories like &lt;b style="color: rgb(255, 163, 79);"&gt;DAG&lt;/b&gt;, UPDATE and RPMforge. For adding extra repositories to yum, please do the following.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;cd /etc/yum.repos.d&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;vi &lt;b style="color: rgb(255, 163, 79);"&gt;dag&lt;/b&gt;.repo&lt;/span&gt;       // the add the following lines in that file//&lt;br /&gt;&lt;br /&gt;[&lt;b style="color: rgb(255, 163, 79);"&gt;dag&lt;/b&gt;]&lt;br /&gt;name=&lt;b style="color: rgb(255, 163, 79);"&gt;Dag&lt;/b&gt; RPM Repository for Red Hat Enterprise Linux&lt;br /&gt;baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/&lt;b style="color: rgb(255, 163, 79);"&gt;dag&lt;/b&gt;&lt;br /&gt;gpgcheck=1&lt;br /&gt;rpm --import &lt;a href="http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt" target="_blank"&gt;http://&lt;b style="color: rgb(255, 163, 79);"&gt;dag&lt;/b&gt;.wieers.com/rpm/packages/RPM-GPG-KEY.&lt;b style="color: rgb(255, 163, 79);"&gt;dag&lt;/b&gt;.txt&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  After this save this file and run the following command&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;yum check-update&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   Now yum will be having more repositories. &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3656063071472193421?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3656063071472193421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3656063071472193421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3656063071472193421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3656063071472193421'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/06/dag-repo-to-yum.html' title='DAG repo to yum'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6426187060566821705</id><published>2009-06-18T21:31:00.000-07:00</published><updated>2009-06-18T21:37:43.662-07:00</updated><title type='text'>MySQL Tweak[core level]</title><content type='html'>A my.cnf values run on a dual xeon with 2 GB's of ram, this is a shared hosting machine that runs MySQL and web, so all memory is not allocated to MySQL.&lt;br /&gt;------------------------------------------------&lt;br /&gt;/etc/my.cnf&lt;br /&gt;&lt;br /&gt;&lt;pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 338px; text-align: left;"&gt;datadir=/var/lib/mysql&lt;br /&gt;socket=/var/lib/mysql/mysql.sock&lt;br /&gt;skip-locking&lt;br /&gt;skip-innodb&lt;br /&gt;query_cache_limit=1M&lt;br /&gt;query_cache_size=32M&lt;br /&gt;query_cache_type=1&lt;br /&gt;max_connections=900&lt;br /&gt;interactive_timeout=100&lt;br /&gt;wait_timeout=100&lt;br /&gt;connect_timeout=10&lt;br /&gt;thread_cache_size=128&lt;br /&gt;#key_buffer=16M&lt;br /&gt;key_buffer=200M&lt;br /&gt;join_buffer=1M&lt;br /&gt;max_allowed_packet=16M&lt;br /&gt;table_cache=1536&lt;br /&gt;sort_buffer_size=1M&lt;br /&gt;read_buffer_size=1M&lt;br /&gt;read_rnd_buffer_size=1M&lt;br /&gt;max_connect_errors=10&lt;br /&gt;# Try number of CPU's*2 for thread_concurrency&lt;br /&gt;thread_concurrency=4&lt;br /&gt;myisam_sort_buffer_size=64M&lt;br /&gt;#log-bin&lt;br /&gt;server-id=1&lt;/pre&gt;&lt;br /&gt;Query caching was added as of MySQL version 4, the following three directives will greatly enhance mysql server performance.&lt;br /&gt;&lt;br /&gt;query_cache_limit=1M&lt;br /&gt;query_cache_size=32M&lt;br /&gt;query_cache_type=1&lt;br /&gt;&lt;br /&gt;Query caching is a server wide variable, so set these generous. I have found the above levels are generally best if you server has at least 512 ram. If you run a server just for DBs with a lot of ram, you can up these quite a bit, like 2m limit and a 64+M cache size.&lt;br /&gt;&lt;br /&gt;The key buffer is a variable that is shared amongst all MySQL clients on the server. A large setting is recomended, particularly helpful with tables that have unique keys. (Most do)&lt;br /&gt;&lt;br /&gt;key_buffer=150M&lt;br /&gt;&lt;br /&gt;The next set of buffers are at a per client level. It is important to play around with these and get them just right for your machine. With the setting below, every active mysql client will have close to 3 MB's in buffers. So 100 clients = almost 300 MB. Giving too much to these buffers will be worse than giving too little. Nothing kills a server quite like memory swapping will.&lt;br /&gt;&lt;br /&gt;sort_buffer_size=1M&lt;br /&gt;read_buffer_size=1M&lt;br /&gt;read_rnd_buffer_size=768K&lt;br /&gt;&lt;br /&gt;The following directive should be set to 2X the number of processors in your machine for best performance.&lt;br /&gt;&lt;br /&gt;thread_concurrency=2&lt;br /&gt;&lt;br /&gt;Heres a few example configurations for servers running MySQL and web for common memory sizes. These are not perfect, but good starting points.&lt;br /&gt;&lt;br /&gt;Server with 512MB RAM:&lt;br /&gt;&lt;br /&gt;thread_cache_size=50&lt;br /&gt;key_buffer=40M&lt;br /&gt;table_cache=384&lt;br /&gt;sort_buffer_size=768K&lt;br /&gt;read_buffer_size=512K&lt;br /&gt;read_rnd_buffer_size=512K&lt;br /&gt;thread_concurrency=2&lt;br /&gt;&lt;br /&gt;For servers with 1 GB ram:&lt;br /&gt;&lt;br /&gt;thread_cache_size=80&lt;br /&gt;key_buffer=150M&lt;br /&gt;table_cache=512&lt;br /&gt;sort_buffer_size=1M&lt;br /&gt;read_buffer_size=1M&lt;br /&gt;read_rnd_buffer_size=768K&lt;br /&gt;thread_concurrency=2&lt;br /&gt;&lt;br /&gt;########################################################&lt;br /&gt;&lt;br /&gt;For optimizing mysql, first we need to know the values of mysql variables and status.&lt;br /&gt;The following are some commands used for this purpose:&lt;br /&gt;# mysqladmin processlist extended-status&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;mysql&gt; show status;&lt;br /&gt;mysql&gt; show variables;&lt;br /&gt;&lt;br /&gt;To get more specific answer, the commands can be enhanced a little more like as follows:&lt;br /&gt;&lt;br /&gt;mysql&gt; show status like '%Open%_tables';&lt;br /&gt;&lt;br /&gt;mysql&gt; show variables like 'table_cache';&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;1. The most important variables in mysql are table_cache and key_buffer_size&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;a) Run the above two commands and check &lt;i&gt;Open_tables&lt;/i&gt; and &lt;i&gt;Opened_tables&lt;/i&gt;&lt;br /&gt;&lt;span style="color:DarkGreen;"&gt;If Opened_tables is big, then your table_cache variable is probably&lt;br /&gt;too small.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;So increase the&lt;/span&gt; &lt;/span&gt;table_cache variable. Open /etc/my.cnf and change/add table_cache=newvalue&lt;br /&gt;&lt;br /&gt;b) Run the following commands to check key_buffer_size, key_read_requests and key_reads&lt;br /&gt;&lt;br /&gt;mysql&gt; show variables like '%key_buffer_size%';&lt;br /&gt;mysql&gt; show status like '%key_read%';&lt;br /&gt;&lt;br /&gt;If key_reads / key_read_requests is &lt; 0.01, key_buffer_size is enough. Otherwise key_buffer_size should be increased.&lt;br /&gt;&lt;br /&gt;Also run the following command to check key_write_requests and key_writes&lt;br /&gt;&lt;br /&gt;mysql&gt; show status like '%key_write%';&lt;br /&gt;&lt;br /&gt;If key_writes / key_write_requests is not less than 1 (near 0.5 seems to be fine), increase key_buffer_size.&lt;br /&gt;&lt;br /&gt;Check the total size of all .MYI files. If it is larger than key_buffer_size change key_buffer_size to total size of MYI files.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;2. &lt;/b&gt;&lt;/u&gt;&lt;u&gt;&lt;b&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Wait_timeout, max_connection, thread_cache&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;If you want to allow more connections, reduce wait_timeout to 15 seconds and increase max_connection as you want.&lt;br /&gt;&lt;br /&gt;Check the number of idle connections. If it is too high reduce the &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;wait_timeout and use &lt;/span&gt;Thread_cache&lt;br /&gt;&lt;i&gt;&lt;br /&gt;How many threads we should keep in a cache for reuse. When a client disconnects, the client's threads are put in the cache if there aren't more than thread_cache_size threads from before. All new threads are first taken from the cache, and only when the cache is empty is a new thread created. This variable can be increased to improve performance if you have a lot of new connections. (Normally this doesn't give a notable performance improvement if you have a good thread implementation.) By examing the difference between the Connections and Threads_created you can see how efficient the current thread cache is for you.&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;span style="color:DarkGreen;"&gt; If Threads_created is big, you may want to increase the&lt;br /&gt;thread_cache_size variable. The cache hit rate can be calculated with&lt;br /&gt;Threads_created/Connections.&lt;br /&gt;&lt;/span&gt;Default thread_cache_size may be 0 if so increase it to 8.&lt;br /&gt;You may try this formula : table_cache = opened table / max_used_connection&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6426187060566821705?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6426187060566821705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6426187060566821705' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6426187060566821705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6426187060566821705'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/06/mysql-tweakcore-level.html' title='MySQL Tweak[core level]'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-5477952148443190710</id><published>2009-06-15T23:58:00.001-07:00</published><updated>2009-06-15T23:58:25.595-07:00</updated><title type='text'>Hub, Switches, and Routers</title><content type='html'>Hub, Switches, and Routers&lt;br /&gt;---------------------------&lt;br /&gt;&lt;br /&gt;Hub&lt;br /&gt;A common connection point for devices in a network. Hubs are commonly used to connect segments of a LAN. A hub contains multiple ports. When a packet arrives at one port, it is copied to the other ports so that all segments of the LAN can see all packets.&lt;br /&gt;&lt;br /&gt;Switch&lt;br /&gt;In networks, a device that filters and forwards packets between LAN segments. Switches operate at the data link layer (layer 2) and sometimes the network layer (layer 3) of the OSI Reference Model and therefore support any packet protocol. LANs that use switches to join segments are called switched LANs or, in the case of Ethernet networks, switched Ethernet LANs.&lt;br /&gt;&lt;br /&gt;Router&lt;br /&gt;A device that forwards data packets along networks. A router is connected to at least two networks, commonly two LANs or WANs or a LAN and its ISP.s network. Routers are located at gateways, the places where two or more networks connect. Routers use headers and forwarding tables to determine the best path for forwarding the packets, and they use protocols such as ICMP to communicate with each other and configure the best route between any two hosts.&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Differences Between These Devices on the Network&lt;br /&gt;Today most routers have become something of a Swiss Army knife, combining the features and functionality of a router and switch/hub into a single unit. So conversations regarding these devices can be a bit misleading — especially to someone new to computer networking.&lt;br /&gt;&lt;br /&gt;The functions of a router, hub and a switch are all quite different from one another, even if at times they are all integrated into a single device. Let's start with the hub and the switch since these two devices have similar roles on the network. Each serves as a central connection for all of your network equipment and handles a data type known as frames. Frames carry your data. When a frame is received, it is amplified and then transmitted on to the port of the destination PC. The big difference between these two devices is in the method in which frames are being delivered.&lt;br /&gt;&lt;br /&gt;In a hub, a frame is passed along or "broadcast" to every one of its ports. It doesn't matter that the frame is only destined for one port. The hub has no way of distinguishing which port a frame should be sent to. Passing it along to every port ensures that it will reach its intended destination. This places a lot of traffic on the network and can lead to poor network response times.&lt;br /&gt;&lt;br /&gt;Additionally, a 10/100Mbps hub must share its bandwidth with each and every one of its ports. So when only one PC is broadcasting, it will have access to the maximum available bandwidth. If, however, multiple PCs are broadcasting, then that bandwidth will need to be divided among all of those systems, which will degrade performance.&lt;br /&gt;&lt;br /&gt;A switch, however, keeps a record of the MAC addresses of all the devices connected to it. With this information, a switch can identify which system is sitting on which port. So when a frame is received, it knows exactly which port to send it to, without significantly increasing network response times. And, unlike a hub, a 10/100Mbps switch will allocate a full 10/100Mbps to each of its ports. So regardless of the number of PCs transmitting, users will always have access to the maximum amount of bandwidth. It's for these reasons why a switch is considered to be a much better choice then a hub.&lt;br /&gt;&lt;br /&gt;Routers are completely different devices. Where a hub or switch is concerned with transmitting frames, a router's job, as its name implies, is to route packets to other networks until that packet ultimately reaches its destination. One of the key features of a packet is that it not only contains data, but the destination address of where it's going.&lt;br /&gt;&lt;br /&gt;A router is typically connected to at least two networks, commonly two Local Area Networks (LANs) or Wide Area Networks (WAN) or a LAN and its ISP's network . for example, your PC or workgroup and EarthLink. Routers are located at gateways, the places where two or more networks connect. Using headers and forwarding tables, routers determine the best path for forwarding the packets. Router use protocols such as ICMP to communicate with each other and configure the best route between any two hosts.&lt;br /&gt;&lt;br /&gt;Today, a wide variety of services are integrated into most broadband routers. A router will typically include a 4 - 8 port Ethernet switch (or hub) and a Network Address Translator (NAT). In addition, they usually include a Dynamic Host Configuration Protocol (DHCP) server, Domain Name Service (DNS) proxy server and a hardware firewall to protect the LAN from malicious intrusion from the Internet.&lt;br /&gt;&lt;br /&gt;All routers have a WAN Port that connects to a DSL or cable modem for broadband Internet service and the integrated switch allows users to easily create a LAN. This allows all the PCs on the LAN to have access to the Internet and Windows file and printer sharing services.&lt;br /&gt;&lt;br /&gt;Some routers have a single WAN port and a single LAN port and are designed to connect an existing LAN hub or switch to a WAN. Ethernet switches and hubs can be connected to a router with multiple PC ports to expand a LAN. Depending on the capabilities (kinds of available ports) of the router and the switches or hubs, the connection between the router and switches/hubs may require either straight-thru or crossover (null-modem) cables. Some routers even have USB ports, and more commonly, wireless access points built into them.&lt;br /&gt;&lt;br /&gt;Some of the more high-end or business class routers will also incorporate a serial port that can be connected to an external dial-up modem, which is useful as a backup in the event that the primary broadband connection goes down, as well as a built in LAN printer server and printer port.&lt;br /&gt;&lt;br /&gt;Besides the inherent protection features provided by the NAT, many routers will also have a built-in, configurable, hardware-based firewall. Firewall capabilities can range from the very basic to quite sophisticated devices. Among the capabilities found on leading routers are those that permit configuring TCP/UDP ports for games, chat services, and the like, on the LAN behind the firewall.&lt;br /&gt;&lt;br /&gt;So, in short, a hub glues together an Ethernet network segment, a switch can connect multiple Ethernet segments more efficiently and a router can do those functions plus route TCP/IP packets between multiple LANs and/or WANs; and much more of course.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-5477952148443190710?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/5477952148443190710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=5477952148443190710' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5477952148443190710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5477952148443190710'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/06/hub-switches-and-routers.html' title='Hub, Switches, and Routers'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-5786650967573030391</id><published>2009-06-15T23:50:00.000-07:00</published><updated>2009-06-15T23:53:18.438-07:00</updated><title type='text'>DNS(Domain Name Service)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_7kkNOFq7H1o/SjdBTzIWkvI/AAAAAAAAAHc/EKRl8JIwarQ/s1600-h/dns.gif"&gt;&lt;img style="cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_7kkNOFq7H1o/SjdBTzIWkvI/AAAAAAAAAHc/EKRl8JIwarQ/s320/dns.gif" alt="" id="BLOGGER_PHOTO_ID_5347814890924315378" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Domain Name Service&lt;br /&gt;Host Names&lt;br /&gt;&lt;br /&gt;Domain Name Service (DNS) is the service used to convert human readable names of hosts to IP addresses. Host names are not case sensitive and can contain alphabetic or numeric letters or the hyphen. Avoid the underscore. A fully qualified domain name (FQDN) consists of the host name plus domain name as in the following example:&lt;br /&gt;&lt;br /&gt;computername.domain.com&lt;br /&gt;&lt;br /&gt;The part of the system sending the queries is called the resolver and is the client side of the configuration. The nameserver answers the queries. Read RFCs 1034 and 1035. These contain the bulk of the DNS information and are superceded by RFCs 1535-1537. Naming is in RFC 1591. The main function of DNS is the mapping of IP addresses to human readable names.&lt;br /&gt;&lt;br /&gt;Three main components of DNS&lt;br /&gt;&lt;br /&gt;1. resolver&lt;br /&gt;2. name server&lt;br /&gt;3. database of resource records(RRs)&lt;br /&gt;&lt;br /&gt;Domain Name System&lt;br /&gt;&lt;br /&gt;The Domain Name System (DNS) is basically a large database which resides on various computers and it contains the names and IP addresses of various hosts on the internet and various domains. The Domain Name System is used to provide information to the Domain Name Service to use when queries are made. The service is the act of querying the database, and the system is the data structure and data itself. The Domain Name System is similar to a file system in Unix or DOS starting with a root. Branches attach to the root to create a huge set of paths. Each branch in the DNS is called a label. Each label can be 63 characters long, but most are less. Each text word between the dots can be 63 characters in length, with the total domain name (all the labels) limited to 255 bytes in overall length. The domain name system database is divided into sections called zones. The name servers in their respective zones are responsible for answering queries for their zones. A zone is a subtree of DNS and is administered separately. There are multiple name servers for a zone. There is usually one primary nameserver and one or more secondary name servers. A name server may be authoritative for more than one zone.&lt;br /&gt;&lt;br /&gt;DNS names are assigned through the Internet Registries by the Internet Assigned Number Authority (IANA). The domain name is a name assigned to an internet domain. For example, mycollege.edu represents the domain name of an educational institution. The names microsoft.com and 3Com.com represent the domain names at those commercial companies. Naming hosts within the domain is up to individuals administer their domain.&lt;br /&gt;&lt;br /&gt;Access to the Domain name database is through a resolver which may be a program or part of an operating system that resides on users workstations. In Unix the resolver is accessed by using the library functions "gethostbyname" and "gethostbyaddr". The resolver will send requests to the name servers to return information requested by the user. The requesting computer tries to connect to the name server using its IP address rather than the name.&lt;br /&gt;&lt;br /&gt;Structure and message format&lt;br /&gt;&lt;br /&gt;The drawing below shows a partial DNS hierarchy. At the top is what is called the root and it is the start of all other branches in the DNS tree. It is designated with a period. Each branch moves down from level to level. When referring to DNS addresses, they are referred to from the bottom up with the root designator (period) at the far right. Example: "myhost.mycompany.com.".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Partial DNS Hierarchy&lt;br /&gt;&lt;br /&gt;DNS is hierarchical in structure. A domain is a subtree of the domain name space. From the root, the assigned top-level domains in the U.S. are:&lt;br /&gt;&lt;br /&gt; * GOV - Government body.&lt;br /&gt; * EDU - Educational body.&lt;br /&gt; * INT - International organization&lt;br /&gt; * NET - Networks&lt;br /&gt; * COM - Commercial entity.&lt;br /&gt; * MIL - U. S. Military.&lt;br /&gt; * ORG - Any other organization not previously listed.&lt;br /&gt;&lt;br /&gt;Outside this list are top level domains for various countries.&lt;br /&gt;&lt;br /&gt;Each node on the domain name system is separated by a ".". Example: "mymachine.mycompany.com.". Note that any name ending in a "." is an absolute domain name since it goes back to root.&lt;br /&gt;DNS Message format:&lt;br /&gt;&lt;br /&gt;Bits Name Description&lt;br /&gt;0-15 Identification Used to match responses to requests. Set by client and returned by server.&lt;br /&gt;16-31 Flags Tells if query or response, type of query, if authoritative answer, if truncated, if recursion desired, and if recursion is available.&lt;br /&gt;32-47 Number of questions&lt;br /&gt;48-63 Number of answer RRs&lt;br /&gt;64-79 Number of authority RRs&lt;br /&gt;80-95 Number of additional RRs&lt;br /&gt;96-?? Questions - variable lengths There can be variable numbers of questions sent.&lt;br /&gt;??-?? Answers - variable lengths Answers are variable numbers of resource records.&lt;br /&gt;??-?? Authority - variable lengths&lt;br /&gt;??-?? Additional Information - variable lengths&lt;br /&gt;&lt;br /&gt;Question format includes query name, query type and query class. The query name is the name being looked up. The query class is normally 1 for internet address. The query types are listed in the table below. They include NS, CNAME, A, etc.&lt;br /&gt;&lt;br /&gt;The answers, authority and additional information are in resource record (RR) format which contains the following.&lt;br /&gt;&lt;br /&gt;1. Domain name&lt;br /&gt;2. Type - One of the RR codes listed below.&lt;br /&gt;3. Class - Normally indicates internet data which is a 1.&lt;br /&gt;4. Time to live field - The number of seconds the RR is saved by the client.&lt;br /&gt;5. Resource data length specifies the amount of data. The data is dependent on its type such as CNAME, A, NS or others as shown in the table below. If the type is "A" the data is a 4 byte IP address.&lt;br /&gt;&lt;br /&gt;The table below shows resource record types:&lt;br /&gt;&lt;br /&gt;Type RR value Description&lt;br /&gt;A 1 Host's IP address&lt;br /&gt;NS 2 Host's or domain's name server(s)&lt;br /&gt;CNAME 5 Host's canonical name, host identified by an alias domain name&lt;br /&gt;PTR 12 Host's domain name, host identified by its IP address&lt;br /&gt;HINFO 13 Host information&lt;br /&gt;MX 15 Host's or domain's mail exchanger&lt;br /&gt;AXFR 252 Request for zone transfer&lt;br /&gt;ANY 255 Request for all records&lt;br /&gt;Usage and file formats&lt;br /&gt;&lt;br /&gt;If a domain name is not found when a query is made, the server may search for the name elsewhere and return the information to the requesting workstation, or return the address of a name server that the workstation can query to get more information. There are special servers on the Internet that provide guidance to all name servers. These are known as root name servers. They do not contain all information about every host on the Internet, but they do provide direction as to where domains are located (the IP address of the name server for the uppermost domain a server is requesting). The root name server is the starting point to find any domain on the Internet.&lt;br /&gt;Name Server Types&lt;br /&gt;&lt;br /&gt;There are three types of name servers:&lt;br /&gt;&lt;br /&gt;1. The primary master builds its database from files that were preconfigured on its hosts, called zone or database files. The name server reads these files and builds a database for the zone it is authoritative for.&lt;br /&gt;2. Secondary masters can provide information to resolvers just like the primary masters, but they get their information from the primary. Any updates to the database are provided by the primary.&lt;br /&gt;3. Caching name server - It gets all its answers to queries from other name servers and saves (caches) the answers. It is a non-authoritative server.&lt;br /&gt;&lt;br /&gt;The caching only name server generates no zone transfer traffic. A DNS Server that can communicate outside of the private network to resolve a DNS name query is referred to as forwarder.&lt;br /&gt;DNS Query Types&lt;br /&gt;&lt;br /&gt;There are two types of queries issued:&lt;br /&gt;&lt;br /&gt;1. Recursive queries received by a server forces that server to find the information requested or post a message back to the querier that the information cannot be found.&lt;br /&gt;2. Iterative queries allow the server to search for the information and pass back the best information it knows about. This is the type that is used between servers. Clients used the recursive query.&lt;br /&gt;3. Reverse - The client provides the IP address and asks for the name. In other queries the name is provided, and the IP address is returned to the client. Reverse lookup entries for a network 192.168.100.0 is "100.168.192.in-addr arpa".&lt;br /&gt;&lt;br /&gt;Generally (but not always), a server-to-server query is iterative and a client-resolver-to-server query is recursive. You should also note that a server can be queried or it can be the person placing a query. Therefore, a server contains both the server and client functions. A server can transmit either type of query. If it is handed a recursive query from a remote source, it must transmit other queries to find the specified name, or send a message back to the originator of the query that the name could not be found.&lt;br /&gt;DNS Transport protocol&lt;br /&gt;&lt;br /&gt;DNS resolvers first attempt to use UDP for transport, then use TCP if UDP fails.&lt;br /&gt;The DNS Database&lt;br /&gt;&lt;br /&gt;A database is made up of records and the DNS is a database. Therefore, common resource record types in the DNS database are:&lt;br /&gt;&lt;br /&gt; * A - Host's IP address. Address record allowing a computer name to be translated into an IP address. Each computer must have this record for its IP address to be located. These names are not assigned for clients that have dynamically assigned IP addresses, but are a must for locating servers with static IP addresses.&lt;br /&gt; * PTR - Host’s domain name, host identified by its IP address&lt;br /&gt; * CNAME - Host’s canonical name allows additional names or aliases to be used to locate a computer.&lt;br /&gt; * MX - Host’s or domain’s mail exchanger.&lt;br /&gt; * NS - Host’s or domain’s name server(s).&lt;br /&gt; * SOA - Indicates authority for the domain&lt;br /&gt; * TXT - Generic text record&lt;br /&gt; * SRV - Service location record&lt;br /&gt; * RP - Responsible person&lt;br /&gt; * HINFO - Host information record with CPU type and operating system.&lt;br /&gt;&lt;br /&gt;When a resolver requests information from the server, the DNS query message indicates one of the preceding types.&lt;br /&gt;DNS Files&lt;br /&gt;&lt;br /&gt; * CACHE.DNS - The DNS Cache file. This file is used to resolve internet DNS queries. On Windows systems, it is located in the WINNTROOT\system32\DNS directory and is used to configure a DNS server to use a DNS server on the internet to resolve names not in the local domain.&lt;br /&gt;&lt;br /&gt;Example Files&lt;br /&gt;&lt;br /&gt;Below is a partial explanation of some records in the database on a Linux based system. The reader should view this information because it explains some important DNS settings that are common to all DNS servers. An example /var/named/db.mycompany.com.hosts file is listed below.&lt;br /&gt;&lt;br /&gt;mycompany.com.  IN SOA mymachine.mycompany.com. root.mymachine.mycompany.com. (&lt;br /&gt;1999112701           ; Serial number as date and two digit number YYMMDDXX&lt;br /&gt;10800                ; Refresh in seconds 28800=8H&lt;br /&gt;3600                 ; Retry in seconds 7200=2H&lt;br /&gt;604800               ; Expire 3600000=1 week&lt;br /&gt;86400 )              ; Minimum TTL 86400=24Hours&lt;br /&gt;mycompany.com.                IN NS mymachine.mycompany.com.&lt;br /&gt;mycompany.com.                IN MX  10  mailmachine.mycompany.com.&lt;br /&gt;mymachine.mycompany.com.      IN A 10.1.0.100&lt;br /&gt;mailmachine.mycompany.com.    IN A 10.1.0.4&lt;br /&gt;george.mycompany.com.         IN A 10.1.3.16&lt;br /&gt;&lt;br /&gt;A Line by line description is as follows:&lt;br /&gt;&lt;br /&gt;1. The entries on this line are:&lt;br /&gt;      1. mycompany.com. - Indicates this server is for the domain mycompany.com.&lt;br /&gt;      2. IN - Indicates Internet Name.&lt;br /&gt;      3. SOA - Indicates this server is the authority for its domain, mycompany.com.&lt;br /&gt;      4. mymachine.mycompany.com. - The primary nameserver for this domain.&lt;br /&gt;      5. root.mymachine.mycompany.com. - The person to contact for more information.&lt;br /&gt;   The lines in the parenthesis, listed below, are for the secondary nameserver(s) which run as slave(s) to this one (since it is the master).&lt;br /&gt;2. 1999112701 - Serial number - If less than master's SN, the slave will get a new copy of this file from the master.&lt;br /&gt;3. 10800 - Refresh - The time in seconds between when the slave compares this file's SN with the master.&lt;br /&gt;4. 3600 - Retry - The time the server should wait before asking again if the master fails to respond to a file update (SOA request).&lt;br /&gt;5. 604800 - Expire - Time in seconds the slave server can respond even though it cannot get an updated zone file.&lt;br /&gt;6. 86400 - TTL - The time to live (TTL) in seconds that a resolver will use data received from a nameserver before it will ask for the same data again.&lt;br /&gt;7. This line is the nameserver resource record. There may be several of these if there are slave name servers.&lt;br /&gt;&lt;br /&gt;   mycompany.com.                IN NS mymachine.mycompany.com.&lt;br /&gt;&lt;br /&gt;   Add any slave server entries below this like:&lt;br /&gt;&lt;br /&gt;   mycompany.com.                IN NS ournamesv1.mycompany.com.&lt;br /&gt;   mycompany.com.                IN NS ournamesv2.mycompany.com.&lt;br /&gt;   mycompany.com.                IN NS ournamesv3.mycompany.com.&lt;br /&gt;&lt;br /&gt;8. This line indicates the mailserver record.&lt;br /&gt;&lt;br /&gt;   mycompany.com.                IN MX  10  mailmachine.mycompany.com.&lt;br /&gt;&lt;br /&gt;   There can be several mailservers. The numeric value on the line indicates the preference or precedence for the use of that mail server. A lower number indicates a higher preference. The range of values is from 0 to 65535. To enter more mailservers, enter a new line for each one similar to the nameserver entries above, but be sure to set the preferences value correctly, at different values for each mailserver.&lt;br /&gt;9. The rest of the lines are the name to IP mappings for the machines in the organization. Note that the nameserver and mailserver are listed here with IP addresses along with any other server machines required for your network.&lt;br /&gt;&lt;br /&gt;   mymachine.mycompany.com.      IN A 10.1.0.100&lt;br /&gt;   mailmachine.mycompany.com.    IN A 10.1.0.4&lt;br /&gt;   george.mycompany.com.         IN A 10.1.3.16&lt;br /&gt;&lt;br /&gt;Domain names written with a dot on the end are absolute names which specify a domain name exactly as it exists in the DNS hierarchy from the root. Names not ending with a dot may be a subdomain to some other domain.&lt;br /&gt;&lt;br /&gt;Aliases are specified in lines like the following:&lt;br /&gt;&lt;br /&gt;mymachine.mycompany.com  IN  CNAME  nameserver.mycompany.com.&lt;br /&gt;george.mycompany.com  IN  CNAME  dataserver.mycompany.com.&lt;br /&gt;Linux1.mycompany.com  IN  CNAME  engserver.mycompany.com.&lt;br /&gt;Linux2.mycompany.com  IN  CNAME  mailserver.mycompany.com.&lt;br /&gt;&lt;br /&gt;When a client (resolver) sends a request, if the nameserver finds a CNAME record, it replaces the requested name with the CNAME, then finds the address of the CNAME value, and return this value to the client.&lt;br /&gt;&lt;br /&gt;A host that has more than one network card which is set to address two different subnets can have more than one address for a name.&lt;br /&gt;&lt;br /&gt;mymachine.mycompany.com  IN  A  10.1.0.100&lt;br /&gt;  IN  A  10.1.1.100&lt;br /&gt;&lt;br /&gt;When a client queries the nameserver for the address of a multi homed host, the nameserver will return the address that is closest to the client address. If the client is on a different network than both the subnet addresses of the multi homed host, the server will return both addresses.&lt;br /&gt;&lt;br /&gt;For more information on practical application of DNS, read the DNS section of the Linux User's Guide.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-5786650967573030391?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/5786650967573030391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=5786650967573030391' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5786650967573030391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5786650967573030391'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/06/dnsdomain-name-service.html' title='DNS(Domain Name Service)'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7kkNOFq7H1o/SjdBTzIWkvI/AAAAAAAAAHc/EKRl8JIwarQ/s72-c/dns.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-1622056405612676896</id><published>2009-06-14T22:37:00.000-07:00</published><updated>2009-06-15T02:26:14.453-07:00</updated><title type='text'>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)</title><content type='html'>[root@sylesh ~]# mysql -u root&lt;br /&gt;ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&gt;&gt;&lt;/span&gt;disabling password authentication&lt;br /&gt;service mysql stop&lt;br /&gt;&lt;br /&gt;wait until MySQL shuts down. Then run&lt;br /&gt;&lt;br /&gt;mysqld_safe --skip-grant-tables &amp;amp;&lt;br /&gt;&lt;br /&gt;then you will be able to login as root with no password.&lt;br /&gt;&lt;br /&gt;mysql -uroot mysql&lt;br /&gt;&lt;br /&gt;In MySQL command line prompt issue the following command:&lt;br /&gt;use databasename;&lt;br /&gt;&lt;br /&gt;UPDATE user SET password=PASSWORD("abcd") WHERE user="root";&lt;br /&gt;FLUSH PRIVILEGES;&lt;br /&gt;            EXIT&lt;br /&gt;&lt;br /&gt;/etc/init.d/mysqld restart&lt;br /&gt;&lt;br /&gt;At this time your root password is reset to "abcd" and MySQL will now&lt;br /&gt;know the privileges and you'll be able to login with your new password:&lt;br /&gt;&lt;br /&gt;mysql -uroot -p mysql&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-1622056405612676896?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/1622056405612676896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=1622056405612676896' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1622056405612676896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1622056405612676896'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/06/error-1045-28000-access-denied-for-user.html' title='ERROR 1045 (28000): Access denied for user &apos;root&apos;@&apos;localhost&apos; (using password: NO)'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7818446030651178610</id><published>2009-06-12T14:29:00.000-07:00</published><updated>2009-06-12T15:38:34.025-07:00</updated><title type='text'>How to enable SSI On Your Server with .htaccess and XBitHack apache directive</title><content type='html'>&lt;h2 class="sub-hdr"&gt;&gt;&gt;&gt;&lt;br /&gt;&lt;/h2&gt;  &lt;p class="cont"&gt;The below notes will demonstrates how to enable SSI on your server using .htaccess.&lt;/p&gt; &lt;p class="cont"&gt;If you are paying for hosting services you may need to get permission from your host to make sure you are not violating their Terms of Service which could result in you getting the boot! Every decent host supports SSI but double-check to make sure.&lt;/p&gt;&lt;br /&gt;&lt;p class="cont"&gt;To enable SSI either create a file simple called .htaccess or edit your existing .htaccess file and place the following code in it:&lt;/p&gt;  &lt;p class="code"&gt;AddType text/html .shtml&lt;br /&gt;AddHandler server-parsed .shtml&lt;br /&gt;Options Indexes FollowSymLinks Includes&lt;br /&gt;&lt;/p&gt;  &lt;p class="cont"&gt;Note: to enable SSI for your full web site place the .htaccess in the root directory of your site; to enable it for just a certain directory place the .htaccess file only in that particular directory.&lt;/p&gt;  &lt;p class="cont"&gt;The first line of the code above tells the server that .shtml is a valid extension. The second line adds a handler to all pages with the .shtml extension which tells the server to parse (process) the document for server side includes.&lt;/p&gt;  &lt;p class="cont"&gt;If you prefer you can use a different file extension for your files which you want parsed for server side includes. Simply change the .shtml to .shtm etc. If you also want your .htm documents parsed by the server (so you don't need to rename all your files) simply add the following after the first line of the code above:&lt;/p&gt;  &lt;p class="code"&gt;AddHandler server-parsed .htm&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="cont"&gt;If you want to use SSI in your default directory page, such as index.shtml you may (but normally won't) need to add the following to the .htaccess file:&lt;/p&gt;  &lt;p class="code"&gt;DirectoryIndex index.shtml index.htm&lt;/p&gt;  &lt;p class="cont"&gt;This means that index.shtml can be your default page. If this page is not found the server will look for index.htm etc. More on this in the .htaccess guides section.&lt;/p&gt;&lt;p class="cont"&gt;&lt;span style="font-size:180%;"&gt;&gt;&gt;SSI Without .shtml&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;  In order to understand what this use of htaccess can do for you, you have to understand what SSI directives are. (SSI directives are covered in the How To Use Your CGI-BIN page.) You can put an SSI directive tag in your Web page, but that doesn't mean the server will look for it. Looking through an html file for SSI directives is called "parsing", and by default a server doesn't parse every html file. It only parses pages that have a .shtml extension.&lt;br /&gt;&lt;br /&gt;      Dilemma:    &lt;br /&gt;&lt;br /&gt;          You want to start using SSI directives in your Web pages to call a script or display certain things on the pages. Your host requires that pages with SSI directives have a .shtml extension. However, over time all of your pages have been linked to and indexed by search engines using their current .html extensions. If you change the extensions to comply with your host, a lot of people will start getting 404 errors.&lt;br /&gt;&lt;br /&gt;  htaccess to the rescue! Certain htaccess statements allow you to tell the server to parse certain pages that don't have a .shtml extension.&lt;br /&gt;&lt;br /&gt;  If you created the htaccess.txt file above, simply add the statements given below to it and re-ftp/rename it. If you didn't, here are the steps:&lt;br /&gt;&lt;br /&gt;     1. Use a text editor to create an htaccess.txt file and enter the following statements into it:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            AddType text/html .html&lt;br /&gt;            AddHandler server-parsed .html&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        replacing .html with .htm if that's what you are using for your pages.&lt;br /&gt;&lt;br /&gt;     2. Save the file and ftp it (using ASCII mode) to your Web root directory (or whatever directory your index.html file is in).&lt;br /&gt;&lt;br /&gt;     3. Rename the htaccess.txt file on the server to .htaccess&lt;br /&gt;&lt;br /&gt;     4. Try it out by entering a URL for one of the pages that contains an SSI directive and see if it's working.&lt;br /&gt;&lt;br /&gt;  The above can be thought of as the "directory method" method for enabling SSI parsing because all files in the directory with the specified extension will be parsed, including files in any sub-directories. SSI parsing does have a small performance price due to all this parsing. If your site has a lot of traffic and a lot of pages that performance price could add up. What if you have a lot of traffic and a lot of pages but you only have a few files that you want parsed? Then you'd want to use XBitHack which is covered in the next section.&lt;br /&gt;&lt;br /&gt;  Not all hosts allow you to use a .htaccess file. They have to use an AllowOverride statement in one of the global configuration files. Ask your host, or a potential host, if they allow the use of .htaccess files. If so, also ask if they allow the use of XbitHack. If they so 'No' to the question of htaccess, pleading with them to enable it on your server may work, especially if you sound like you know what you're talking about (which this page will help you to do).&lt;br /&gt;&lt;br /&gt;  A .htaccess file is a very powerful tool. You can use it to set up password-protected directories, change the way Apache responds to certain events, etc. The flip side of that is that you can really hose things up or give unintended access to visitors if you're not careful. You may want to try out your attempts with .htaccess during low-traffic times on your Website so that any problems can be corrected without affecting too many visitors.&lt;br /&gt;&lt;br /&gt;  Note also that the very fact that this is a very powerful tool may be reason enough for some hosting services not to allow you to use it. A hosting service sets up multiple "virtual" Web servers so multiple domains can be hosting on a single system (each domain having it's own virtual Web server). They do this by adding statements (aka directives) to the main Apache configuration file (named httpd.conf). When they add these virtual server directives they must include the directive to enable htaccess functionality. If you try the above and it doesn't work, chances are good your host doesn't have the htaccess function enabled.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What is XBitHack&lt;br /&gt;----------------&lt;br /&gt;&lt;br /&gt;  XBitHack (pronounced "X bit hack") is simply one of those htaccess configuration statements mentioned above. If you're not willing to put up with the performance costs of the "directory method" for enabling parsing of non-.shtml pages covered above, think of XBitHack as a "file method". This is because you can specify on a file-by-file basis which non-.shtml files get parsed.&lt;br /&gt;&lt;br /&gt;  Using XBitHack for this "file method" has two steps:&lt;br /&gt;&lt;br /&gt;      * turn on XBitHack by adding the statement to your .htaccess file&lt;br /&gt;      * "flag" the html pages you want parsed by changing their permissions to something a little out of the ordinary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  If you created the htaccess.txt file above, simply add the statement given below to it and re-ftp/rename it to enable XBitHack. If your .htaccess file contains the AddType and AddHandler statements from above, REMOVE THEM. If you didn't create the file earlier, here are the steps to enabling XBitHack:&lt;br /&gt;&lt;br /&gt;     1. Use a text editor to create an htaccess.txt file and enter the following statement into it:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            XBitHack on&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     2. Save the file and ftp it (using ASCII mode) to your Web root directory (or whatever directory your index.html file is in).&lt;br /&gt;&lt;br /&gt;     3. Rename the htaccess.txt file to .htaccess&lt;br /&gt;&lt;br /&gt;     4. CHMOD the page files, and only the page files, that you want parsed (i.e. that will contain SSI directives) to 744 (instead of 644). This is what tells the server to parse the page.&lt;br /&gt;&lt;br /&gt;     5. Try it out by entering a URL for one of the pages that contains an SSI directive and see if it's working.&lt;br /&gt;&lt;br /&gt;        If it doesn't work, check your error log for a message like&lt;br /&gt;&lt;br /&gt;        XBitHack not allowed here&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  It is possible that your host allows htaccess but not XBitHack. If you don't find the above error, you'll have to contact your host's technical support operation. However, by knowing what htaccess and XBitHack are, you can ask them intelligent questions regarding your problem. When they realize you know what you are talking about, they will be less likely to feed you a line of BS. Also, don't be surprised if the support person you speak to doesn't know what you are talking about. First-line technical support and sales people are usually entry-level jobs in an organization. If you get the sense they don't know what you are talking about, ask to speak to a more senior support person who does.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7818446030651178610?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7818446030651178610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7818446030651178610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7818446030651178610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7818446030651178610'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/06/how-to-enable-ssi-on-your-server-with.html' title='How to enable SSI On Your Server with .htaccess and XBitHack apache directive'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7486354565112049203</id><published>2009-06-10T07:50:00.000-07:00</published><updated>2009-06-10T07:52:42.288-07:00</updated><title type='text'>dbmmanage - Manage user authentication files in DBM format(apache binary)</title><content type='html'>&lt;h1&gt;DBM User Authentication&lt;/h1&gt; &lt;span class="body"&gt;     &lt;p&gt;       This week, we explain how to store user authentication       information in DBM files for faster access when you have       thousands of users.     &lt;/p&gt;     &lt;p&gt;       The feature on User Authentication shows how to restrict pages to       selected people. We showed how to use the &lt;b&gt;htpasswd&lt;/b&gt;       program to create the necessary .htpasswd files, and how to       create group files to provide more control over the users. We       also said that .htpasswd files and group files like this are       not very efficient when a large number of users are involved.       This is because these are plain text files and for every       request in the authenticated area Apache has to read through       the file looking for the user. A much faster way to store the       user information is to use files in &lt;b&gt;DBM&lt;/b&gt; format. This       article explains how to create and manage DBM format user       authentication files.     &lt;/p&gt;     &lt;/span&gt; &lt;h2&gt;What is DBM?&lt;/h2&gt; &lt;span class="body"&gt;     &lt;p&gt;       DBM files are a simple and relatively standard method of       storing information for quick retrieval. Each item of       information stored in a DBM file consists of two parts: a       &lt;b&gt;key&lt;/b&gt; and a &lt;b&gt;value&lt;/b&gt;. If you know the key you can       access the value very quickly. The DBM file maintains an       'index' of the keys, each of which points to where the value       is stored within the file, and the index is usually arranged       such that values can be accessed with the minimum number of       file system accesses even for very large numbers of keys.     &lt;/p&gt;     &lt;p&gt;       In practice, on many systems a DBM 'file' is actually stored       in two files on the disk. If, for example, a DBM file called       'users' is created, it will actually be stored in files       called &lt;b&gt;users.pag&lt;/b&gt; and &lt;b&gt;users.dir&lt;/b&gt;. If you ever       need to rename or delete a DBM from the command line,       remember to change &lt;i&gt;both&lt;/i&gt; the files, keeping the       extensions (.pag and .dir) the same. Some newer versions of       DBM only create one file.     &lt;/p&gt;     &lt;p&gt;       Provided the key is known in advance DBM format files are a       very efficient way of accessing information associated with       that key. For web user authentication, the key will be the       username, and the value will store their (encrypted)       password. Looking up usernames and their passwords in a DBM       file will be more efficient than using a plain text file when       more than a few users are involved. This will be particularly       important for sites with lots of users (say, over 10,000) or       where there are lots of accesses to authenticated pages.     &lt;/p&gt;     &lt;/span&gt; &lt;h2&gt;Preparing Apache for DBM Files&lt;/h2&gt; &lt;span class="body"&gt;     &lt;p&gt;       If you want to use DBM format files with Apache, you will       need to make sure it is compiled with DBM support. By       default, Apache cannot use DBM files for user authentication,       so the optional DBM authentication module needs to be       included. Note that this is included &lt;i&gt;in addition&lt;/i&gt; to       the normal user authentication module (which uses plain text       files, as explained in the previous article). It is possible       to have support for multiple file formats compiled into       Apache at the same time.     &lt;/p&gt;     &lt;p&gt;       To add the DBM authentication module, edit your Configuration       file in the Apache src directory. Remove the comment from the       line which currently says     &lt;/p&gt; &lt;pre&gt;  # Module dbm_auth_module     mod_auth_dbm.o&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       To remove the comment, delete the # and space character at       the right-hand end of the line. Now update the Apache       configuration by running &lt;samp&gt;./Configure&lt;/samp&gt;, then re-make       the executable with &lt;samp&gt;make&lt;/samp&gt;.     &lt;/p&gt;     &lt;p&gt;       However, before compiling you might also need to tell Apache       where to find the DBM functions. On some systems this is       automatic. On others you will need to add the text       &lt;samp&gt;-lndbm&lt;/samp&gt; or &lt;samp&gt;-ldbm&lt;/samp&gt; to the EXTRA_LIBS line in       the Configuration file. (Apache 1.2 will attempt to do this       automatically if needed, but you might still need to       configure it manually in some cases). If you are not sure       what your system requires, try leaving it blank and       compiling. If at the end of the compilation you see errors       about functions such as _dbm_fetch() not being found, try       each of these choices in turn. (Remember to re-run       &lt;samp&gt;./Configure&lt;/samp&gt; after changing Configuration). If you       still cannot get it to compile, you might have a system where       the DBM library is installed in a non-standard directory, or       where the there is no DBM library available. You could either       contact you system administrator, or download and compile       your own copy of the DBM libraries.     &lt;/p&gt;     &lt;/span&gt; &lt;h2&gt;Creating A DBM Users File&lt;/h2&gt; &lt;span class="body"&gt;     &lt;p&gt;       For standard (htpasswd) user authentication password files,       the program htpasswd is used to add new users and set their       passwords. To create and manage DBM format user files another       program from the Apache support directory is used. The       program is called &lt;b&gt;dbmmanage&lt;/b&gt; and is written in perl (so       you will need perl on your system, and it will need to have       been compiled with support for the same DBM library you       compiled into Apache. If you have only just installed DBM on       your system you will might need to re-compile perl to build       in DBM support).     &lt;/p&gt;     &lt;p&gt;       This program can be used to create a new DBM file, add users       and passwords to it, change passwords, or delete users. To       start by creating a new DBM file and adding a user to it, run       the command:     &lt;/p&gt; &lt;pre&gt;  dbmmanage /usr/local/etc/httpd/usersdbm adduser martin hamster&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       The creates the DBM file /usr/local/etc/httpd/usersdbm (which       might actually consist of /usr/local/etc/httpd/usersdbm.dir       and /usr/local/etc/httpd/usersdbm.pag), if it does not       already exist. It then adds the user 'martin' with password       'hamster'. This command can be used with other usernames and       passwords to add more users, or with an existing username to       change that user's password. A user can be deleted from the       password file with     &lt;/p&gt; &lt;pre&gt;   dbmmanage /usr/local/etc/httpd/usersdbm delete martin&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       You can get a list of all the users in the DBM file with     &lt;/p&gt; &lt;pre&gt;   dbmmanage /usr/local/etc/httpd/usersdbm view&lt;br /&gt;&lt;/pre&gt;     &lt;/span&gt; &lt;h2&gt;Restricting a Directory&lt;/h2&gt; &lt;span class="body"&gt;     &lt;p&gt;       Now you have a DBM user authentication file with some users       in it, you are ready to create an authenticated area. You can       restrict a directory either using a &lt;directory&gt; section       in access.conf or by using a .htaccess file. The feature on       user authentication explained how you can set up a basic       .htaccess file, using this example:     &lt;/p&gt; &lt;pre&gt;  AuthName "restricted stuff"&lt;br /&gt; AuthType Basic&lt;br /&gt; AuthUserFile /usr/local/etc/httpd/users&lt;br /&gt;&lt;br /&gt; require valid-user&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       To use DBM files, the only change is to replace the directive       &lt;samp&gt;AuthUserFile&lt;/samp&gt; line with     &lt;/p&gt; &lt;pre&gt;  AuthDBMUserFile /usr/local/etc/httpd/usersdbm&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       This single change tells Apache that the user file is now in       a DBM format, rather than plain text. All the rest of the       user authentication setup remains the same (so the       authentication type is still Basic, and the syntax of       &lt;samp&gt;require&lt;/samp&gt; is the same as before).     &lt;/p&gt;     &lt;/span&gt; &lt;h2&gt;Using Groups&lt;/h2&gt; &lt;span class="body"&gt;     &lt;p&gt;       Each user can be in one or more "groups", and you can       restrict access to people just in a specified group. This       makes it possible to manage all your users on your site in a       single database, and customise the areas that each can       access. The use of DBM files for storing group information is       particularly efficient because you can use the same file to       store both password and group information.     &lt;/p&gt;     &lt;p&gt;       The &lt;samp&gt;dbmmanage&lt;/samp&gt; command can be used to set group       information for users. For example, to add the user "martin"       to the group "staff", you would use     &lt;/p&gt; &lt;pre&gt;  dbmmanage /usr/local/etc/httpd/users adduser martin hamster staff&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       You put a user into multiple groups but listing them,       separated by commas. For example,     &lt;/p&gt; &lt;pre&gt;  dbmmanage /usr/local/etc/httpd/users adduser martin hamster staff,admin&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       Note that dbmmanage has to be told the password as well, and       there is no way to set or change group information for a user       without knowing their password. This means in practice that       dbmmanage is not suitable for managing users in groups, and       you will have to write your own management scripts. Some help       writing perl to manage DBM files is given later in this       article.     &lt;/p&gt;     &lt;p&gt;       After creating a user and group file containing details of       which users are in which groups, you can restrict access by       these groups. For example, to restrict access to an area to       only people in the group &lt;b&gt;staff&lt;/b&gt;, you could use:     &lt;/p&gt; &lt;pre&gt;  AuthName "restricted stuff"&lt;br /&gt; AuthType Basic&lt;br /&gt; AuthDBMUserFile /usr/local/etc/httpd/users&lt;br /&gt; AuthDBMGroupFile /usr/local/etc/httpd/users&lt;br /&gt;&lt;br /&gt; require group staff&lt;br /&gt;&lt;/pre&gt;     &lt;/span&gt; &lt;h2&gt;Custom Management of DBM Files&lt;/h2&gt; &lt;span class="body"&gt;     &lt;p&gt;       The supplied dbmmanage script to manage DBM files is adequate       for basic editing, but cannot handle advanced use, such as       managing group information. It is also command line driven,       while a Web interface might be a better choice in many       situations. To do either of these things you will have to       write programs to manage DBM files yourself. Using perl this       is not too difficult.     &lt;/p&gt;     &lt;p&gt;       As a simple example, say you have an existing .htpasswd file       and you want to convert it to a DBM file, putting all the       users in a specific group. We will introduce the concepts       here, and there is a link below to the completed program for       you to download. It will be written in Perl which is quick to       write and easy to customise, although the principles of DBM       use are the same whatever language is used.     &lt;/p&gt;     &lt;p&gt;       The basic way to look in a DBM file is given here. DBM files       are opened in Perl as 'hashed arrays'. The "key" is the user       name, and the value is the encrypted password and optionally       group information. A simple script to lookup all the keys and       values in a DBM is:     &lt;/p&gt; &lt;pre&gt;  dbmopen(%DBM, "/usr/local/etc/httpd", 0644) ||&lt;br /&gt;                        die "Cannot open file: $!\n";&lt;br /&gt; while (($key, $value) = each %DBM) {&lt;br /&gt;   print "key=$key, value=$value\n";&lt;br /&gt; }&lt;br /&gt; dbmclose(%DBM);&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       Note that if the given DBM file does not exist, it will be       created. This script will work with both perl 4 and perl 5       (although Perl 5 users might prefer to use the new &lt;b&gt;tie&lt;/b&gt;       facility instead of dbmopen). To lookup a known key you would       use:     &lt;/p&gt; &lt;pre&gt;  $key = "martin";&lt;br /&gt;&lt;br /&gt; dbmopen(%DBM, "/usr/local/etc/httpd", 0644) ||&lt;br /&gt;                                       die "Cannot open file: $!\n";&lt;br /&gt; $value = $DBM{$key};&lt;br /&gt; if (!defined($value)) {&lt;br /&gt;   print "$key not stored\n";&lt;br /&gt; } else {&lt;br /&gt;   print "key=$key, value=$value\n";&lt;br /&gt; }&lt;br /&gt; dbmclose(%DBM);&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       Now we can write a script to convert a htpasswd file into a       DBM database, optionally putting each user into one or more       groups. The script is htpasswd2dbm.pl ,       and is used like this:     &lt;/p&gt; &lt;pre&gt;  cd /usr/local/etc/httpd&lt;br /&gt; htpasswd2dbm.pl -htpasswd users usersdbm&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       The -htpasswd option specifies the htpasswd file to be read,       the the final argument is the DBM file to create (or add to).       To set a group, use the -group argument. For example, to put       all the users from this file into the groups admin and staff,       use     &lt;/p&gt; &lt;pre&gt;  htpasswd2dbm.pl -htpasswd users -group admin,staff usersdbm&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       The program will add users to an existing DBM database, so it       can be used to merge multiple htpasswd files. If you give       users from different files different groups, you will be able       to set up access restrictions on a group-by-group basis, and       manage all your users in one database. Note that if there is       already a user with the same username in the DBM file it will       be overwritten by the new information.     &lt;/p&gt;     &lt;p&gt;       Group information stored in a DBM file as part of the value.       If no group information is stored, the key associated with a       username just consists of the encrypted password. To store       group information, the encrypted password is followed by a       colon, then a list of groups that the user is in, each       separated by a comma. So a typical key might look like this:     &lt;/p&gt; &lt;pre&gt;  E7yT67YGht65:admin,staff&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       A program written in perl can easily extract the group       information, for example:     &lt;/p&gt; &lt;pre&gt;  $value = $DBM{$key};&lt;br /&gt; ($enc, $groupfield) = split(/:/, $value);&lt;br /&gt; @groups = split(/,/, $groupfield);&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       It is also possible to store additional information in the       DBM file, by following the groups list with a colon. Apache       will ignore any data after a colon following the groups list,       so it could be used, for example, to store the real name and       contact details for the user, and an expiry date. This could       be stored in the DBM like this:     &lt;/p&gt; &lt;pre&gt;  $DBM{$key} = join(":", $enc, join(",", @groups),&lt;br /&gt;                          $realname, $company, $emailaddr,&lt;br /&gt;                          $expdate);&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;       Keeping all the user information together in a database like       this, which Apache can also use for user authentication, can       make administering a site with many users simpler.     &lt;/p&gt;     &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7486354565112049203?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7486354565112049203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7486354565112049203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7486354565112049203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7486354565112049203'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/06/dbmmanage-manage-user-authentication.html' title='dbmmanage - Manage user authentication files in DBM format(apache binary)'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7638233435426594546</id><published>2009-05-28T22:38:00.000-07:00</published><updated>2009-05-28T23:10:05.106-07:00</updated><title type='text'>TCP Wrapper</title><content type='html'>&lt;h1 class="SECT1"&gt;&lt;span style="font-weight: normal; font-style: italic;font-size:100%;" &gt;TCP Wrapper is a host-based Networking ACL system, used to filter network access to Internet Protocol servers on (Unix-like) operating systems such as Linux or BSD. It allows host or subnetwork IP addresses, names and/or ident query replies, to be used as tokens on which to filter for access control purposes.&lt;/span&gt;&lt;br /&gt;&lt;/h1&gt;&lt;h1 class="SECT1"&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;&lt;h1 class="SECT1"&gt;&lt;span style="font-size:130%;"&gt;TCP Wrappers Configuration Files&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;(From redhat.com)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;To determine if a client machine is allowed to connect to a service,  TCP wrappers reference the following two files, which are commonly  referred to as hosts access files:       &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="FILENAME"&gt;/etc/hosts.allow&lt;/tt&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="FILENAME"&gt;/etc/hosts.deny&lt;/tt&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; When a client request is received by a TCP wrapped service, it takes the  following basic steps:       &lt;/p&gt;&lt;ol type="1"&gt;&lt;li&gt;&lt;p&gt;&lt;i class="EMPHASIS"&gt;The service references    &lt;tt class="FILENAME"&gt;/etc/hosts.allow&lt;/tt&gt;.&lt;/i&gt; — The TCP    wrapped service sequentially parses the    &lt;tt class="FILENAME"&gt;/etc/hosts.allow&lt;/tt&gt; file and applies the first rule    specified for that service. If it finds a matching rule, it allows the    connection. If not, it moves on to step 2.    &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;i class="EMPHASIS"&gt;The service references    &lt;tt class="FILENAME"&gt;/etc/hosts.deny&lt;/tt&gt;.&lt;/i&gt; — The TCP    wrapped service sequentially parses the    &lt;tt class="FILENAME"&gt;/etc/hosts.deny&lt;/tt&gt; file. If it finds a matching rule    is denies the connection. If not, access to the service is granted.    &lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt; The following are important points to consider when using TCP wrappers  to protect network services:       &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Because access rules in &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt; are applied      first, they take precedence over rules specified in      &lt;tt class="FILENAME"&gt;hosts.deny&lt;/tt&gt;. Therefore, if access to a service is      allowed in &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt;, a rule denying access to      that same service in &lt;tt class="FILENAME"&gt;hosts.deny&lt;/tt&gt; is      ignored.     &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Since the rules in each file are read from the top down and the first      matching rule for a given service is the only one applied, the order      of the rules is extremely important.    &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;If no rules for the service are found in either file, or if neither file      exists, access to the service is granted.    &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;TCP wrapped services do not cache the rules from the hosts      access files, so any changes to &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt; or      &lt;tt class="FILENAME"&gt;hosts.deny&lt;/tt&gt; take effect immediately without      restarting network services.    &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="SECT2"&gt;&lt;h2 class="SECT2"&gt;&lt;a name="S2-TCPWRAPPERS-ACCESS-RULES"&gt;&lt;/a&gt;15.2.1. Formatting Access Rules&lt;/h2&gt;&lt;p&gt;   The format for both &lt;tt class="FILENAME"&gt;/etc/hosts.allow&lt;/tt&gt; and    &lt;tt class="FILENAME"&gt;/etc/hosts.deny&lt;/tt&gt; are identical. Any blank lines or    lines that start with a hash mark (&lt;tt class="COMMAND"&gt;#&lt;/tt&gt;)    are ignored, and each rule must be on its own line.  &lt;/p&gt;&lt;p&gt;   Each rule uses the following basic format to control access to network    services:  &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;&lt;tt class="REPLACEABLE"&gt;&lt;i&gt;&lt;daemon&gt;&lt;/daemon&gt;&lt;/i&gt;&lt;/tt&gt;: &lt;tt class="REPLACEABLE"&gt;&lt;i&gt;&lt;client&gt;&lt;/client&gt;&lt;/i&gt;&lt;/tt&gt; [: &lt;tt class="REPLACEABLE"&gt;&lt;i&gt;&lt;/i&gt;&lt;/tt&gt;: &lt;tt class="REPLACEABLE"&gt;&lt;i&gt;&lt;/i&gt;&lt;/tt&gt;: ...]&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="REPLACEABLE"&gt;&lt;i&gt;&lt;daemon&gt;&lt;/daemon&gt;&lt;/i&gt;&lt;/tt&gt; — A comma        separated list of process names (&lt;i class="EMPHASIS"&gt;not&lt;/i&gt; service        names) or the &lt;tt class="COMMAND"&gt;ALL&lt;/tt&gt;        &lt;i class="FIRSTTERM"&gt;wildcard&lt;/i&gt; (see &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S3-TCPWRAPPERS-ACCESS-RULES-WILD"&gt;Section 15.2.1.1 &lt;i&gt;Wildcards&lt;/i&gt;&lt;/a&gt;). The daemon list also        accepts &lt;i class="FIRSTTERM"&gt;operators&lt;/i&gt; listed in &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S3-TCPWRAPPERS-ACCESS-RULES-OP"&gt;Section 15.2.1.3 &lt;i&gt;Operators&lt;/i&gt;&lt;/a&gt; to allow greater        flexibility.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="REPLACEABLE"&gt;&lt;i&gt;&lt;client&gt;&lt;/client&gt;&lt;/i&gt;&lt;/tt&gt; — A comma        separated list of hostnames, host IP addresses, special        &lt;i class="FIRSTTERM"&gt;patterns&lt;/i&gt; (see &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S3-TCPWRAPPERS-ACCESS-RULES-PAT"&gt;Section 15.2.1.2 &lt;i&gt;Patterns&lt;/i&gt;&lt;/a&gt;), or special wildcards        (see &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S3-TCPWRAPPERS-ACCESS-RULES-WILD"&gt;Section 15.2.1.1 &lt;i&gt;Wildcards&lt;/i&gt;&lt;/a&gt;) which        identify the hosts effected by the rule. The client list also        accepts operators listed in &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S3-TCPWRAPPERS-ACCESS-RULES-OP"&gt;Section 15.2.1.3 &lt;i&gt;Operators&lt;/i&gt;&lt;/a&gt; to allow greater        flexibility.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="REPLACEABLE"&gt;&lt;i&gt;&lt;/i&gt;&lt;/tt&gt; — An optional        action or colon separated list of actions performed when the rule        is triggered. Option fields support        &lt;i class="FIRSTTERM"&gt;expansions&lt;/i&gt; (see &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S3-TCPWRAPPERS-ACCESS-RULES-OPTIONS-EXP"&gt;Section 15.2.3.4 &lt;i&gt;Expansions&lt;/i&gt;&lt;/a&gt;),         launch shell commands, allow or deny access, and alter        logging behavior (see &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S2-TCPWRAPPERS-ACCESS-RULES-OPTIONS"&gt;Section 15.2.3 &lt;i&gt;Option Fields&lt;/i&gt;&lt;/a&gt;).      &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;   The following is a basic sample hosts access    rule:       &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;vsftpd : .example.com &lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;   This rule instructs TCP wrappers to watch for connections to the FTP    daemon (&lt;tt class="COMMAND"&gt;vsftpd&lt;/tt&gt;) from any host in the    &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain. If this rule appears in    &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt;, the connection will be accepted. If    this rule appears in &lt;tt class="FILENAME"&gt;hosts.deny&lt;/tt&gt;, the connection    will be rejected.  &lt;/p&gt;&lt;p&gt;   The next sample hosts access rule is more complex    and uses two option fields:  &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;sshd : .example.com  \&lt;br /&gt;: spawn /bin/echo `/bin/date` access denied&gt;&gt;/var/log/sshd.log \&lt;br /&gt;: deny&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;   Note that in this example that each option field is preceded by the    backslash (&lt;tt class="COMMAND"&gt;\&lt;/tt&gt;). Use of the backslash prevents    failure of the rule due to length.  &lt;/p&gt;&lt;div class="WARNING"&gt;&lt;table class="WARNING" border="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" valign="top" width="25"&gt;&lt;img src="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/stylesheet-images/warning.png" alt="Warning" hspace="5" /&gt;&lt;/td&gt;&lt;th align="left" valign="CENTER"&gt;&lt;b&gt;Warning&lt;/b&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="left" valign="top"&gt;&lt;p&gt;     If the last line of a hosts access file is not a newline character      (created by pressing the &lt;span class="KEYCAP"&gt;&lt;keycap&gt;[Enter]&lt;/keycap&gt;&lt;/span&gt; key), the last rule      in the file will fail and an error will be logged to either      &lt;tt class="FILENAME"&gt;/var/log/messages&lt;/tt&gt; or      &lt;tt class="FILENAME"&gt;/var/log/secure&lt;/tt&gt;. This is also the case for a      rule lines that span multiple lines without using the backslash. The      following example illustrates the relevant portion of a log message      for a rule failure due to either of these circumstances:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;warning: /etc/hosts.allow, line 20: missing newline or line too long&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt; This sample rule states that if a connection to the SSH  daemon (&lt;tt class="COMMAND"&gt;sshd&lt;/tt&gt;) is attempted from a host in the  &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain, execute the  &lt;tt class="COMMAND"&gt;echo&lt;/tt&gt; command (which will log the attempt to a special  file), and deny the connection. Because the optional  &lt;tt class="COMMAND"&gt;deny&lt;/tt&gt; directive is used, this line will deny access  even if it appears in the &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt; file. For a  more detailed look at available options, see &lt;a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-tcpwrappers-access.html#S2-TCPWRAPPERS-ACCESS-RULES-OPTIONS"&gt;Section 15.2.3 &lt;i&gt;Option Fields&lt;/i&gt;&lt;/a&gt;.       &lt;/p&gt;&lt;div class="SECT3"&gt;&lt;h3 class="SECT3"&gt;&lt;a name="S3-TCPWRAPPERS-ACCESS-RULES-WILD"&gt;&lt;/a&gt;15.2.1.1. Wildcards&lt;/h3&gt;&lt;p&gt;     Wildcards allow TCP wrappers to more easily match groups of daemons      or hosts. They are used most frequently in the client list field of      access rules.    &lt;/p&gt;&lt;p&gt;     The following wildcards may be used:    &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;ALL&lt;/tt&gt; — Matches everything. It can be        used for both the daemon list and the client list.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;LOCAL&lt;/tt&gt; — Matches any host that does        not contain a period (&lt;tt class="COMMAND"&gt;.&lt;/tt&gt;), such as localhost.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;KNOWN&lt;/tt&gt; — Matches any host where the hostname        and host address are known or where the user is known.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;UNKNOWN&lt;/tt&gt; — Matches any host where the        hostname or host address are unknown or where the user is unknown.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;PARANOID&lt;/tt&gt; — Matches any host where the        hostname does not match the host address.      &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="CAUTION"&gt;&lt;table class="CAUTION" border="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" valign="top" width="25"&gt;&lt;img src="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/stylesheet-images/caution.png" alt="Caution" hspace="5" /&gt;&lt;/td&gt;&lt;th align="left" valign="CENTER"&gt;&lt;b&gt;Caution&lt;/b&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="left" valign="top"&gt;&lt;p&gt;     The &lt;tt class="COMMAND"&gt;KNOWN&lt;/tt&gt;, &lt;tt class="COMMAND"&gt;UNKNOWN&lt;/tt&gt;, and      &lt;tt class="COMMAND"&gt;PARANOID&lt;/tt&gt; wildcards should be used with care as a      disruption in name resolution may prevent legitimate users from      gaining access to a service.    &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="SECT3"&gt;&lt;h3 class="SECT3"&gt;&lt;a name="S3-TCPWRAPPERS-ACCESS-RULES-PAT"&gt;&lt;/a&gt;15.2.1.2. Patterns&lt;/h3&gt;&lt;p&gt;     Patterns can be used in the client list field of access rules to      more precisely specify groups of client hosts.    &lt;/p&gt;&lt;p&gt;     The following is a list of the most common accepted patterns for a      client list entry:    &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;i class="EMPHASIS"&gt;Hostname beginning with a period   (&lt;tt class="COMMAND"&gt;.&lt;/tt&gt;)&lt;/i&gt; — Placing a period at   the beginning of a hostname, matches all hosts sharing the   listed components of the name. The following example would apply   to any host within the &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain:        &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;ALL : .example.com&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;i class="EMPHASIS"&gt;IP address ending with a period   (&lt;tt class="COMMAND"&gt;.&lt;/tt&gt;)&lt;/i&gt; — Placing a period   at the end of an IP address matches all hosts sharing   the initial numeric groups of an IP address. The following example   would apply to any host within the   &lt;tt class="COMMAND"&gt;192.168.x.x&lt;/tt&gt; network:        &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;ALL : 192.168.&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;i class="EMPHASIS"&gt;IP address/netmask pair&lt;/i&gt; — Netmask   expressions can also be used as a pattern to control access to a   particular group of IP addresses. The following example would   apply to any host with an address of   &lt;tt class="COMMAND"&gt;192.168.0.0&lt;/tt&gt; through   &lt;tt class="COMMAND"&gt;192.168.1.255&lt;/tt&gt;:        &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;ALL : 192.168.0.0/255.255.254.0&lt;/tt&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;i class="EMPHASIS"&gt;The asterisk    (&lt;tt class="COMMAND"&gt;*&lt;/tt&gt;)&lt;/i&gt; — Asterisks can be used   to match entire groups of hostnames or IP addresses, as long as   they are not mixed in a client list containing other types of   patterns. The following example would apply to any host within   the &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain:        &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;ALL : *.example.com&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;i class="EMPHASIS"&gt;The slash (&lt;tt class="COMMAND"&gt;/&lt;/tt&gt;)&lt;/i&gt;   — If a client list begins with a slash, it is   treated as a file name. This is useful if rules specifying large   numbers of hosts are necessary. The following example refers TCP   wrappers to the &lt;tt class="FILENAME"&gt;/etc/telnet.hosts&lt;/tt&gt; file for   all Telnet connections:        &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;in.telnetd : /etc/telnet.hosts&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;     Other, lesser used patterns are also accepted by TCP wrappers. See the      hosts access man 5 page for more information.    &lt;/p&gt;&lt;div class="WARNING"&gt;&lt;table class="WARNING" border="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" valign="top" width="25"&gt;&lt;img src="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/stylesheet-images/warning.png" alt="Warning" hspace="5" /&gt;&lt;/td&gt;&lt;th align="left" valign="CENTER"&gt;&lt;b&gt;Warning&lt;/b&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="left" valign="top"&gt;&lt;p&gt;       Be very careful when creating rules requiring name resolution,        such as hostnames and domain names. Attackers can use a variety of        tricks to circumvent accurate name resolution. In addition, any        disruption in DNS service would prevent even authorized users from        using network services.      &lt;/p&gt;&lt;p&gt;       It is best to use IP addresses whenever possible.      &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="SECT3"&gt;&lt;h3 class="SECT3"&gt;&lt;a name="S3-TCPWRAPPERS-ACCESS-RULES-OP"&gt;&lt;/a&gt;15.2.1.3. Operators&lt;/h3&gt;&lt;p&gt;     At present, access control rules accept one operator,      &lt;tt class="COMMAND"&gt;EXCEPT&lt;/tt&gt;. It can be used in both the daemon list      and the client list of a rule.    &lt;/p&gt;&lt;p&gt;     The &lt;tt class="COMMAND"&gt;EXCEPT&lt;/tt&gt; operator allows specific exceptions to      broader matches within the same rule.    &lt;/p&gt;&lt;p&gt;     In the following example from a &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt;      file, all &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; hosts are allowed to      connect to all services except      &lt;tt class="COMMAND"&gt;cracker.example.com&lt;/tt&gt;:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;ALL: .example.com EXCEPT cracker.example.com&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;     In the another example from a &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt; file,      clients from the 192.168.0.&lt;tt class="REPLACEABLE"&gt;&lt;i&gt;x&lt;/i&gt;&lt;/tt&gt; network can      use all services except for FTP:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;ALL EXCEPT vsftpd: 192.168.0.&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="NOTE"&gt;&lt;table class="NOTE" border="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" valign="top" width="25"&gt;&lt;img src="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/stylesheet-images/note.png" alt="Note" hspace="5" /&gt;&lt;/td&gt;&lt;th align="left" valign="CENTER"&gt;&lt;b&gt;Note&lt;/b&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="left" valign="top"&gt;&lt;p&gt;     Organizationally, it is often easier to use      &lt;tt class="COMMAND"&gt;EXCEPT&lt;/tt&gt; operators sparingly, placing the      exceptions to a rule in the other access control file. This allows      other administrators to quickly scan the appropriate files to see      what hosts should are allowed or denied access to services, without      having to sort through the various &lt;tt class="COMMAND"&gt;EXCEPT&lt;/tt&gt;      operators.    &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="SECT2"&gt;&lt;h2 class="SECT2"&gt;&lt;a name="S2-TCPWRAPPERS-ACCESS-RULES-PORT"&gt;&lt;/a&gt;15.2.2. Portmap and TCP Wrappers&lt;/h2&gt;&lt;p&gt;   When creating access control rules for &lt;tt class="COMMAND"&gt;portmap&lt;/tt&gt;, do    not use hostnames as its implementation of TCP wrappers does not    support host look ups. For this reason, only use IP addresses or the    keyword &lt;tt class="COMMAND"&gt;ALL&lt;/tt&gt; when specifying hosts is in    &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt; or &lt;tt class="FILENAME"&gt;hosts.deny&lt;/tt&gt;.  &lt;/p&gt;&lt;p&gt;   In addition, changes to &lt;tt class="COMMAND"&gt;portmap&lt;/tt&gt; access control rules    may not take affect immediately.  &lt;/p&gt;&lt;p&gt;   Widely used services, such as NIS and NFS, depend on    &lt;tt class="COMMAND"&gt;portmap&lt;/tt&gt; to operate, so be aware of these    limitations.  &lt;/p&gt;&lt;/div&gt;&lt;div class="SECT2"&gt;&lt;h2 class="SECT2"&gt;&lt;a name="S2-TCPWRAPPERS-ACCESS-RULES-OPTIONS"&gt;&lt;/a&gt;15.2.3. Option Fields&lt;/h2&gt;&lt;p&gt;   In addition to basic rules allowing and denying access, the Red Hat Linux    implementation of TCP wrappers supports extensions to the access    control language through option fields. By using option fields within    hosts access rules, administrators can accomplish a    variety of tasks such as altering log behavior, consolidating access    control, and launching shell commands.  &lt;/p&gt;&lt;div class="SECT3"&gt;&lt;h3 class="SECT3"&gt;&lt;a name="S3-TCPWRAPPERS-ACCESS-RULES-LOG"&gt;&lt;/a&gt;15.2.3.1. Logging&lt;/h3&gt;&lt;p&gt;     Option fields let administrators easily change the log facility      and priority level for a rule by using the      &lt;tt class="COMMAND"&gt;severity&lt;/tt&gt; directive.    &lt;/p&gt;&lt;p&gt;     In the following example, connections to the SSH daemon from any      host in the &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain are logged to the      the default &lt;tt class="COMMAND"&gt;authpriv&lt;/tt&gt; facility (because no      facility value is specified) with a priority of      &lt;tt class="COMMAND"&gt;emerg&lt;/tt&gt;:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;sshd : .example.com : severity emerg&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;     It is also possible to specify a facility using the      &lt;tt class="COMMAND"&gt;severity&lt;/tt&gt; option. The following example logs any      SSH connection attempts by hosts from the      &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain to the      &lt;tt class="COMMAND"&gt;local0&lt;/tt&gt; facility with a priority of      &lt;tt class="COMMAND"&gt;alert&lt;/tt&gt;:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;sshd : .example.com : severity local0.alert&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="NOTE"&gt;&lt;table class="NOTE" border="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center" valign="top" width="25"&gt;&lt;img src="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/stylesheet-images/note.png" alt="Note" hspace="5" /&gt;&lt;/td&gt;&lt;th align="left" valign="CENTER"&gt;&lt;b&gt;Note&lt;/b&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="left" valign="top"&gt;&lt;p&gt;       In practice, this example will not work until the syslog daemon        (&lt;tt class="COMMAND"&gt;syslogd&lt;/tt&gt;) is configured to log to the        &lt;tt class="COMMAND"&gt;local0&lt;/tt&gt; facility. See the        &lt;tt class="COMMAND"&gt;syslog.conf&lt;/tt&gt; man page for information about        configuring custom log facilities.      &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="SECT3"&gt;&lt;h3 class="SECT3"&gt;&lt;a name="S3-TCPWRAPPERS-ACCESS-RULES-ACCESS"&gt;&lt;/a&gt;15.2.3.2. Access Control&lt;/h3&gt;&lt;p&gt;     Option fields also allow administrators to explicitly allow or deny      hosts in a single rule by adding the &lt;tt class="COMMAND"&gt;allow&lt;/tt&gt; or      &lt;tt class="COMMAND"&gt;deny&lt;/tt&gt; directive as the final option.    &lt;/p&gt;&lt;p&gt;     For instance, the following two rules allow SSH connections from      &lt;tt class="COMMAND"&gt;client-1.example.com&lt;/tt&gt;, but deny connections from      &lt;tt class="COMMAND"&gt;client-2.example.com&lt;/tt&gt;:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;sshd : client-1.example.com : allow&lt;br /&gt;sshd : client-2.example.com : deny&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;     By allowing access control on a per-rule basis, the option field      allows administrators to consolidate all access rules into a single file:      either &lt;tt class="FILENAME"&gt;hosts.allow&lt;/tt&gt; or      &lt;tt class="FILENAME"&gt;hosts.deny&lt;/tt&gt;. Some consider this an easier way of      organizing access rules.    &lt;/p&gt;&lt;/div&gt;&lt;div class="SECT3"&gt;&lt;h3 class="SECT3"&gt;&lt;a name="S3-TCPWRAPPERS-ACCESS-RULES-COMM"&gt;&lt;/a&gt;15.2.3.3. Shell Commands&lt;/h3&gt;&lt;p&gt;     Option fields allow access rules to launch shell commands through      the following two directives:    &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;spawn&lt;/tt&gt; — Launches a shell command as   a child process. This option directive can perform tasks like   using &lt;tt class="COMMAND"&gt;/usr/sbin/safe_finger&lt;/tt&gt; to get more   information about the requesting client or create special log   files using the &lt;tt class="COMMAND"&gt;echo&lt;/tt&gt; command.        &lt;/p&gt;&lt;p&gt;In the following example, clients attempting to access Telnet   services from the &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain are   quietly logged to a special file:        &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;in.telnetd : .example.com \&lt;br /&gt;: spawn /bin/echo `/bin/date` from %h&gt;&gt;/var/log/telnet.log \&lt;br /&gt;: allow&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;twist&lt;/tt&gt; — Replaces the requested        service with the specified command. This directive is often used        to set up traps for intruders (also called "honey pots"). It can        also be used to send messages to connecting clients. The twist        command must occur at the end of the rule line.        &lt;/p&gt;&lt;p&gt;In the following example, clients attempting to access FTP   services from  the &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain are   sent a message via the &lt;tt class="COMMAND"&gt;echo&lt;/tt&gt; command:        &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="90%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;vsftpd : .example.com \&lt;br /&gt;: twist /bin/echo "421 Bad hacker, go away!"&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;     For more information about shell command options, see the      &lt;tt class="FILENAME"&gt;hosts_options&lt;/tt&gt; man page.    &lt;/p&gt;&lt;/div&gt;&lt;div class="SECT3"&gt;&lt;h3 class="SECT3"&gt;&lt;a name="S3-TCPWRAPPERS-ACCESS-RULES-OPTIONS-EXP"&gt;&lt;/a&gt;15.2.3.4. Expansions&lt;/h3&gt;&lt;p&gt;     Expansions, when used in conjunction with the      &lt;tt class="COMMAND"&gt;spawn&lt;/tt&gt; and &lt;tt class="COMMAND"&gt;twist&lt;/tt&gt; directives      provide information about the client, server, and processes      involved.    &lt;/p&gt;&lt;p&gt;     Below is a list of supported expansions:    &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%a&lt;/tt&gt; — The client's IP address.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%A&lt;/tt&gt; — The server's IP address.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%c&lt;/tt&gt; — Supplies a variety of client        information, such as the username and hostname, or the username   and IP address.        &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%d&lt;/tt&gt; — The daemon process name.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%h&lt;/tt&gt; — The client's hostname (or IP address,   if the hostname is unavailable).        &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%H&lt;/tt&gt; — The server's hostname (or IP address,   if the hostname is unavailable).      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%n&lt;/tt&gt; — The client's hostname. If unavailable,   &lt;tt class="COMMAND"&gt;unknown&lt;/tt&gt; is printed. If the client's   hostname and host address do not match,   &lt;tt class="COMMAND"&gt;paranoid&lt;/tt&gt; is printed.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%N&lt;/tt&gt; — The server's hostname. If unavailable,   &lt;tt class="COMMAND"&gt;unknown&lt;/tt&gt; is printed. If the server's   hostname and host address do not match,        &lt;tt class="COMMAND"&gt;paranoid&lt;/tt&gt; is printed.        &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%p&lt;/tt&gt; — The daemon process ID.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%s&lt;/tt&gt; — Various types of server information,   such as the daemon process and the host or IP address of the server.      &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt class="COMMAND"&gt;%u&lt;/tt&gt; — The client's username. If unavailable,   &lt;tt class="COMMAND"&gt;unknown&lt;/tt&gt; is printed.        &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;     The following sample rule uses an expansion in conjunction with the      &lt;tt class="COMMAND"&gt;spawn&lt;/tt&gt; command to identify the client host in a      customized log file.    &lt;/p&gt;&lt;p&gt;     It instructs TCP wrappers that if a connection      to the SSH daemon (&lt;tt class="COMMAND"&gt;sshd&lt;/tt&gt;) is attempted from a host      in the &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain, execute the      &lt;tt class="COMMAND"&gt;echo&lt;/tt&gt; command to log the attempt, including the      client hostname (using the &lt;tt class="COMMAND"&gt;%h&lt;/tt&gt; expansion), to a      special file:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;sshd : .example.com  \&lt;br /&gt;: spawn /bin/echo `/bin/date` access denied to %h&gt;&gt;/var/log/sshd.log \&lt;br /&gt;: deny&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;     Similarly, expansions can be used to personalize messages back to      the client. In the following example, clients attempting to access FTP      services from the &lt;tt class="COMMAND"&gt;example.com&lt;/tt&gt; domain are informed      that they have been banned from the server:    &lt;/p&gt;&lt;table class="SCREEN" bgcolor="#dcdcdc" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="SCREEN"&gt;&lt;tt class="COMMAND"&gt;vsftpd : .example.com \&lt;br /&gt;: twist /bin/echo "421 %h has been banned from this server!"&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;     For a full explanation of available expansions, as well as      additional access control options, review see section 5 of the man      pages for &lt;tt class="FILENAME"&gt;hosts_access&lt;/tt&gt; (&lt;tt class="COMMAND"&gt;man 5      hosts_access&lt;/tt&gt;) and the man page for      &lt;tt class="FILENAME"&gt;hosts_options&lt;/tt&gt;.    &lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7638233435426594546?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7638233435426594546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7638233435426594546' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7638233435426594546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7638233435426594546'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/tcp-wrapper.html' title='TCP Wrapper'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7924400561640687226</id><published>2009-05-28T22:27:00.000-07:00</published><updated>2009-05-28T22:28:13.034-07:00</updated><title type='text'>PAM (Pluggable authentication module)</title><content type='html'>Note: this document is written in reference to Red Hat Linux 6.2+&lt;br /&gt;&lt;br /&gt;PAM (Pluggable authentication module) is very diverse in the types of modules it provides. One could accomplish many authentication tasks using PAM. However PAM expands itself beyond typical authentication programs, as it allows an admin to employ other system-critical features such as resource limiting, su protection, and TTY restrictions. Much of PAM's features are not within the scope of this document, but for further reading you can refer to the links at the bottom of this document.&lt;br /&gt;&lt;br /&gt;Firstly we must enable the pam_limits module, inside /etc/pam.d/login. Add the following to the end of the file:&lt;br /&gt;&lt;br /&gt;session required /lib/security/pam_limits.so&lt;br /&gt;&lt;br /&gt;After adding the line above, the /etc/pam.d/login file should look something like this:&lt;br /&gt;&lt;br /&gt;#%PAM-1.0&lt;br /&gt;auth required /lib/security/pam_securetty.so&lt;br /&gt;auth required /lib/security/pam_stack.so service=system-auth&lt;br /&gt;auth required /lib/security/pam_nologin.so&lt;br /&gt;account required /lib/security/pam_stack.so service=system-auth&lt;br /&gt;password required /lib/security/pam_stack.so service=system-auth&lt;br /&gt;session required /lib/security/pam_stack.so service=system-auth&lt;br /&gt;session optional /lib/security/pam_console.so&lt;br /&gt;session required /lib/security/pam_limits.so&lt;br /&gt;&lt;br /&gt;The limits.conf file located under the /etc/security directory can be used to control and set resource policies. limits.conf is well commented and easy to use - so do take the time to skim over its contents. It is important to set resource limits on all your users so they can't perform denial of service attacks with such things as fork bombs, amongst other things it can also stop 'stray' server processes from taking the system down with it.&lt;br /&gt;&lt;br /&gt;It is also a good idea to separate rules for users, admins, and other (other being everything else). This is important, cause take for instance a scenario where a user fork bombs the system - it could in effect disable an administrator's ability to login to the system and take proper actions, or worse crash the server.&lt;br /&gt;&lt;br /&gt;Below is the default policy used on a server iv configured:&lt;br /&gt;&lt;br /&gt;# For everyone (users and other)&lt;br /&gt;* hard core 0&lt;br /&gt;* - maxlogins 12&lt;br /&gt;* hard nproc 50&lt;br /&gt;* hard rss 20000&lt;br /&gt;&lt;br /&gt;# For group wheel (admins)&lt;br /&gt;@wheel - maxlogins 5&lt;br /&gt;@wheel hard nproc 80&lt;br /&gt;@wheel hard rss 75000&lt;br /&gt;&lt;br /&gt;#End of file&lt;br /&gt;&lt;br /&gt;The first set of rules say to prohibit the creation of core files - core 0 , restrict the number of processes to 50 - nproc 50, restrict logins to 12 - maxlogins 12, and restrict memory usage to 20MB - rss 20000 for everyone except the super user. The the later rules for admins, say to restrict logins to 5 - maxlogins 5, restrict the number of processes to 80 - nproc 80, and restrict the memory usage to 75MB - rss 75000.&lt;br /&gt;&lt;br /&gt;All the above only concerns users who have entered via the login prompt on your system. The asterisk (*) defines all users and at wheel (@wheel) defines only users in group wheel. Make sure to add your administrative users into the wheel group (this can be done in /etc/group).&lt;br /&gt;&lt;br /&gt;Finally edit the /etc/profile file and change the following line:&lt;br /&gt;&lt;br /&gt;ulimit -c 1000000&lt;br /&gt;&lt;br /&gt;to read:&lt;br /&gt;&lt;br /&gt;ulimit -S -c 1000000 &gt; /dev/null 2&lt;&amp;amp;1&lt;br /&gt;&lt;br /&gt;This modification is used to avoid getting error messages like 'Unable to reach limit' during login. On newer editions of Red Hat Linux, the later ulimit setting is default.&lt;br /&gt;&lt;br /&gt;Further reading is available in The Linux-PAM System Administrators' Guide located at:&lt;br /&gt;&lt;a href="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam.html" target="_blank"&gt;http://www.kernel.org/pub/linux/libs/pam/L...M-html/pam.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7924400561640687226?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7924400561640687226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7924400561640687226' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7924400561640687226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7924400561640687226'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/pam-pluggable-authentication-module.html' title='PAM (Pluggable authentication module)'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3625677203029825269</id><published>2009-05-28T22:12:00.000-07:00</published><updated>2009-05-28T22:13:02.023-07:00</updated><title type='text'>Tripwire: a very effective host intrustion detection system.</title><content type='html'>&lt;p&gt;A crude yet effective intrusion detection system such as Tripwire can      alert systems administrators to possible intrusion attempts by      periodically verifying the integrity of a server's file systems.      Systems intruders will often use trojan binaries for &lt;tt&gt;login&lt;/tt&gt;,      &lt;tt&gt;su&lt;/tt&gt;, &lt;tt&gt;ps&lt;/tt&gt;, and &lt;tt&gt;ls&lt;/tt&gt;, etc. to cover their tracks      and keep a low profile on the system.  Under normal circumstances even      astute systems administrators may not observe the intrusion because the      trojan binaries mimic the system binaries so well.    &lt;/p&gt;&lt;p&gt;One tried and true method to alert systems administrators of unexpected      file system alterations is to use a software package such as Tripwire to      keep a database of checksums on the file sizes of critical system files.      Depending on the configuration, Tripwire can notify appropriate personnel      if a critical file or directory is modified or deleted.    &lt;/p&gt;&lt;p&gt;By using a strong checksum method similar to MD5, Tripwire can identify      with absolute certainty whether or not a file has been modified, unlike      similar programs that use weaker algorithms such as CRC to calculate      checksums.    &lt;/p&gt;&lt;p&gt;Also, for maximum effectiveness Tripwire should be installed at the time      the operating system is installed to ensure that the system does not      already have any trojan binaries.  Tripwire is only as reliable as the      initial file system its database is based upon.  If the file system has      already been attacked, then Tripwire can only identify further damage to      the filesystem, if that.        &lt;/p&gt;&lt;h3&gt;The Linux Open Source Edition&lt;/h3&gt;    &lt;p&gt;Recently, &lt;a href="http://www.tripwire.com/"&gt;Tripwire, Inc.&lt;/a&gt; has      decided to open the source for a more recent version of the Tripwire      package specifically for the Linux OS.  Previously, a binary only version      of the software had been made available to the Linux community and      another version of the software with and an older, less featured academic      source license had been available to the public.  The Linux open source      edition includes most of the newer features of the software, such as the      ability to alert specific administrators for different areas of      alterations, while remaining compatible with the commercial version of      the software.         &lt;/p&gt;&lt;h3&gt;Getting the Software&lt;/h3&gt;    &lt;p&gt;Binary packages are available at &lt;a href="http://www.tripwire.org/downloads/index.php"&gt;tripwire.org&lt;/a&gt; for use with the Red Hat 7.0 distribution of      Linux, though the binaries work fine on similar RPM based distributions      such as Mandrake.  For other types of Linux distributions, Tripwire will      need to be compiled from the source tarballs located on the same page.      For Red Hat 7.0, the RPM binaries are also available on the second binary      CD of the distribution.         &lt;/p&gt;&lt;h3&gt;Installing Tripwire&lt;/h3&gt;    &lt;p&gt;Although it isn't a difficult procedure to compile Tripwire from source,      this article will be limited to describing the installation process from      the binary RPM.    &lt;/p&gt;&lt;p&gt;If Tripwire is downloaded from the website listed above, please be aware      that the RPM is also tar/gzipped.  Thus, to install the Tripwire RPM,      issue the following commands as root:  &lt;/p&gt;&lt;pre&gt;  tar xvzf tripwire-2.3-47.i386.tar.gz&lt;br /&gt;&lt;br /&gt; rpm -ivh tripwire-2.3-47.i386.rpm&lt;br /&gt;&lt;/pre&gt;      &lt;p&gt;Once the software is installed with rpm, the installation shell script      will need to be executed to finish the Tripwire installation.  This is      done by issuing the command:  &lt;/p&gt;&lt;pre&gt;  /etc/tripwire/twinstall.sh&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;as root.  Note that all Tripwire associated files are kept in the      &lt;tt&gt;/etc/tripwire&lt;/tt&gt; directory.     &lt;/p&gt;&lt;h3&gt;Initial Tripwire Configuration&lt;/h3&gt;    &lt;p&gt;Because very few Linux installations are identical, Tripwire will need a      fair amount of configuration to adequately protect the system.      Configuration begins during the installation script launched above with      the selection of site and local passphrases.  These passphrases are the      key to preventing intruders from modifying your Tripwire installation and      circumventing its protection so strong passphrases are essential!    &lt;/p&gt;&lt;p&gt;The site key is used to sign Tripwire's policy and configuration files      while the local key is used for signing the database files.  For      enterprise wide installations, the use of multiple levels of passwords      makes Tripwire more manageable by allowing a site to split administration      functions across by a number of system administrators.    &lt;/p&gt;&lt;p&gt;The installation script creates default policy and configuration files      stored in &lt;tt&gt;/etc/tripwire&lt;/tt&gt; as &lt;tt&gt;twpol.txt&lt;/tt&gt; and      &lt;tt&gt;twcfg.txt&lt;/tt&gt;.  These files are in cleartext and need to be removed      from the system as soon as the encrypted versions are in place for      obvious security reasons.    &lt;/p&gt;&lt;p&gt;The default policy probably includes monitoring for a number of files not      present on the local system, so it's important to trim these files out      of policy.  The following procedures will illustrate exactly how this is      done.    &lt;/p&gt;&lt;p&gt;The default policy should be installed using the command as root:  &lt;/p&gt;&lt;pre&gt;  /usr/sbin/twadmin -m P /etc/tripwire/twpol.txt&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;Next, generate the initial database using the following command as root:  &lt;/p&gt;&lt;pre&gt;  /usr/sbin/tripwire -m i&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;Note that the &lt;tt&gt;-m&lt;/tt&gt; switch identifies the mode in which Tripwire is being      executed, which is "i" for "initialization" in this case.  Later, the      "c" mode for "check" will be used.  Expect the initialization to take      quite a long time, even on a fast machine.  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;         &lt;h3&gt;Customizing Tripwire's Configuration&lt;/h3&gt;    &lt;p&gt;Once and initial database is created, some customization is necessary to      prevent the issuance of a large number of false alarms.  These false      alarms occur any time there is a discrepancy in the default policy and      the local system's current configuration.  To generate a listing of the      discrepancies between the local system and the default policy, issue the      following command as root:  &lt;/p&gt;&lt;pre&gt;  /usr/sbin/tripwire -m c | grep Filename &gt;&gt; twtest.txt&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;Note that this command will also take several minutes to complete.  Once      this listing has been generated, edit the policy file,      &lt;tt&gt;/etc/tripwire/twpol.txt&lt;/tt&gt;, and comment out or delete each of the      filenames listed in &lt;tt&gt;twtest.txt&lt;/tt&gt;.    &lt;/p&gt;&lt;p&gt;Additionally, there are other files in the default policy that may not      make sense to monitor on the local system.  These include lock files      (which identify that some process is in use) and pid files (which      identify the process ID of some daemons).  Since the files are likely to      change often, if not at every system boot, they can cause Tripwire to      generate false positives.  To avoid such problems, comment out all of the      &lt;tt&gt;/var/lock/subsys&lt;/tt&gt; entries as well as the entry for      &lt;tt&gt;/var/run&lt;/tt&gt;.      &lt;/p&gt;&lt;h3&gt;Finalizing the Tripwire Configuration&lt;/h3&gt;    &lt;p&gt;Any time the tripwire policy file is edited, the policy needs to be      reinstalled and the database will need to be recreated.  As before, these      tasks are accomplished by issuing the following commands as root:  &lt;/p&gt;&lt;pre&gt;  /usr/sbin/twadmin -m P /etc/tripwire/twpol.txt&lt;br /&gt;&lt;br /&gt; /usr/sbin/tripwire -m i&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;At this point it wouldn't be a bad idea to repeat the customization      procedures just to ensure that none of the unnecessary files listed in      twtest.txt were omitted.    &lt;/p&gt;&lt;p&gt;It's now safe to delete the clear text versions of the Tripwire policy      and configuration files, which can be performed by issuing the following      command as root:  &lt;/p&gt;&lt;pre&gt;  rm /etc/tripwire/twcfg.txt /etc/tripwire/twpol.txt&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;If they need to be restored cleartext versions of these files can be      created from the encrypted versions by issuing the command (and providing      the appropriate passphrases):  &lt;/p&gt;&lt;pre&gt;  /usr/sbin/twadmin -m p &gt; /etc/tripwire/twpol.txt&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;Note that unlike before, the "p" in this command is lowercase.    &lt;/p&gt;&lt;p&gt;Finally, it is desirable to save a copy of the database at least      initially and periodically if possible to read-only media such as CD-R.      Having read-only copies of the database file is the only way to guarantee      100% that Tripwire's database is authentic.     &lt;/p&gt;&lt;h3&gt;Scheduling a Nightly Tripwire Analysis&lt;/h3&gt;    &lt;p&gt;Without regular checks of the filesystem, Tripwire is effectively      useless, so this section will identify how to schedule Nightly Tripwire      Analyses that are e-mail to the system administrator.    &lt;/p&gt;&lt;p&gt;First, one needs to create a shell script for generating the Tripwire      reports.  Creating the shell script can be more useful than just placing      the command in the crontab because it allows the administrator to perform      a filesystem check without needing to remember the exact syntax necessary      for doing so.    &lt;/p&gt;&lt;p&gt;Create the file "&lt;tt&gt;runtw.sh&lt;/tt&gt;" in the directory      &lt;tt&gt;/usr/local/bin&lt;/tt&gt; that has the following contents:  &lt;/p&gt;&lt;pre&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;/usr/sbin/tripwire -m c | mail -s "Tripwire Report from HOST" root@localhost&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;Of course, HOST should be changed to the hostname of the system.  Don't      forget to make the shell script executable by root.    &lt;/p&gt;&lt;p&gt;Then, schedule the script to execute nightly at 1:01am by adding the line:  &lt;/p&gt;&lt;pre&gt;  1 1 * * *     /usr/local/bin/runtw.sh&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;to root's crontab using the command:  &lt;/p&gt;&lt;pre&gt;  crontab -e&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;Tripwire will now submit nightly reports to the system administrator on      the status of the file system's integrity.     &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3625677203029825269?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3625677203029825269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3625677203029825269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3625677203029825269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3625677203029825269'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/tripwire-very-effective-host-intrustion.html' title='Tripwire: a very effective host intrustion detection system.'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-8849046548572076435</id><published>2009-05-28T22:10:00.000-07:00</published><updated>2009-05-28T22:11:30.794-07:00</updated><title type='text'></title><content type='html'>&lt;p align="center"&gt;&lt;strong&gt;Mailmon Installation&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt; &lt;p&gt;cd /usr/src/&lt;br /&gt;  wget http://www.mycutelife.net/sanju/newtickethelp/mailmon/mailmon_1-3.tar.gz&lt;br /&gt;  tar -xvzf mailmon_1-3.tar.gz&lt;br /&gt;  cd /usr/src/MailMon&lt;br /&gt;  cp -f /usr/sbin/sendmail /usr/sbin/mon.bkp&lt;br /&gt;  wget http://www.mycutelife.net/sanju/newtickethelp/mailmon/mailmon.new&lt;br /&gt;  sed -e s/opteron.dnsprotect.com/$hostname/g mailmon.new &gt; mailmon.temp;&lt;br /&gt;  cp -f mailmon.temp /usr/sbin/sendmail&lt;br /&gt;  cd /usr/sbin&lt;br /&gt;  chown root.mailtrap sendmail&lt;br /&gt;  chmod 755 sendmail&lt;br /&gt;  chattr +i sendmail&lt;br /&gt;  cd /var/log&lt;br /&gt;  touch mailmon.log&lt;br /&gt;  chmod 622 mailmon.log&lt;br /&gt;  touch mailmon.junk&lt;br /&gt;  chmod 622 mailmon.junk&lt;/p&gt; &lt;p&gt;mysql&lt;br /&gt;  mysql&gt;create database mailmon2005;&lt;br /&gt;  mysql&gt;grant all privileges on mailmon2005.* to mailmon2005@localhost identified by '123dsa';&lt;br /&gt;  mysql&gt;use mailmon2005;&lt;/p&gt; &lt;p&gt;CREATE TABLE `limits` (&lt;br /&gt;  `id` int(11) NOT NULL auto_increment,&lt;br /&gt;  `user` varchar(20) NOT NULL default '',&lt;br /&gt;  `speedlimit` int(11) NOT NULL default '0',&lt;br /&gt;  `seconds` int(11) NOT NULL default '0',&lt;br /&gt;  PRIMARY KEY (`id`)&lt;br /&gt;  ) TYPE=MyISAM AUTO_INCREMENT=6 ;&lt;br /&gt;  INSERT INTO `limits` VALUES (6, 'cpanel', 200, 3600);&lt;br /&gt;  CREATE TABLE `mailmon` (&lt;br /&gt;  `user` varchar(20) NOT NULL default '',&lt;br /&gt;  `timestamp` int(10) unsigned NOT NULL default '0',&lt;br /&gt;  `script_name` varchar(255) NOT NULL default '',&lt;br /&gt;  KEY `user` (`user`,`timestamp`)&lt;br /&gt;  ) TYPE=MyISAM;&lt;/p&gt; mysql&gt; quit;&lt;br /&gt;&lt;br /&gt;Courtesy: Sanju Abraham&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-8849046548572076435?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/8849046548572076435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=8849046548572076435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/8849046548572076435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/8849046548572076435'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/mailmon-installation-mailmon.html' title=''/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-4963945465395066928</id><published>2009-05-28T21:56:00.000-07:00</published><updated>2009-05-28T22:02:50.696-07:00</updated><title type='text'>Vulnerability Scanner:  Nessus</title><content type='html'>&lt;span class="a3"&gt;If you're looking for a vulnerability scanner, chances are you've come across a number of expensive commercial products and tools with long lists of features and benefits. Unfortunately, if you're in the same situation as most of us, you simply don't have the budget to implement fancy high-priced systems. You might have considered compromising by turning to free tools like &lt;a href="http://searchsecurity.techtarget.com/general/0,295582,sid14_gci1224310,00.html"&gt;nmap&lt;/a&gt;. However, you probably saw these tools as a compromise, as their feature sets didn't quite match the commercial offerings. &lt;p&gt; It's time that you learn how to use Nessus! This free tool offers a surprisingly robust feature-set and is widely supported by the information security community. It doesn't take long between the discovery of a new vulnerability and the posting of an updated script for Nessus to detect it. In fact, Nessus takes advantage of the Common Vulnerabilities and Exposures (CVE) architecture that facilitates easy cross-linking between compliant security tools. &lt;/p&gt;&lt;p&gt; The Nessus tool works a little differently than other scanners. Rather than purporting to offer a single, all-encompassing vulnerability database that gets updated regularly, Nessus supports the Nessus Attack Scripting Language (NASL), which allows security professionals to use a simple language to describe individual attacks. Nessus administrators then simply include the NASL descriptions of all desired vulnerabilities to develop their own customized scans. &lt;/p&gt;&lt;p&gt; With the release of Nessus 3 in December 2005, Tenable Network Security Inc., the company behind Nessus, introduced a complete overhaul of the product. The most current version at the time of this writing, Nessus 3.2, was released in March 2008. Nessus is now available for a wide variety of platforms, including Windows, various flavors of Linux, FreeBSD, Solaris and Mac OS X. Here's an overview of the significant changes in Nessus 3:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;b&gt;Nessus is now closed-source&lt;/b&gt;. The base product is still available for free. With the introduction of Nessus 3, however, Tenable moved Nessus from an open source to a commercial licensing model. In other words, while the software itself remains free, updated vulnerability information will come with a fee, at least for enterprises (home users may download updates for free). Tenable cites the need to invest in the future of Nessus as the motivation for moving to a proprietary license scheme.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Significant speed enhancements&lt;/b&gt;. In benchmarking tests performed by Tenable, Nessus 3 scans systems at about twice the speed of Nessus 2. This is due to optimizations in the scan engine and a complete overhaul of NASL. &lt;/li&gt;&lt;li&gt;&lt;b&gt;Dramatic reduction in resource requirements.&lt;/b&gt; Nessus 3 uses significantly less memory and CPU cycles than Nessus 2, allowing simultaneous scanning of a larger number of hosts.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Nessus uses a modular architecture consisting of centralized servers that conduct scanning and remote clients that allow for administrator interaction. You may deploy Nessus scanning servers at various points within your enterprise and control them from a single client. This allows you to effectively scan segmented networks from multiple vantage points and conduct scans of large networks that require multiple servers running simultaneously.&lt;/p&gt;&lt;p&gt; If you're looking for a robust, inexpensive vulnerability scanning product, definitely take Nessus out for a test drive! The tips in this tutorial will guide you along the way. &lt;/p&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Nessus Installation on Red Hat Linux&lt;br /&gt;&lt;br /&gt;BEFORE WE BEGIN&lt;br /&gt;===============================&lt;br /&gt;I understand that there are many ways to install and configure Nessus. This tutorial covers only one of them. This tutorial makes several assumptions:&lt;br /&gt;1. You are competent with Windows, Linux and basic networking. If you don’t know how to use command line FTP for example, then this tutorial will be of no use to you.&lt;br /&gt;2. You have 2 computers, one with a Windows and the other with Red Hat, both in good working order. It also assumes that you have at least one supported compiler such as GCC installed on your Red Hat Box.&lt;br /&gt;3. This tutorial is written by me with no references or “borrowed” material. If something doesn’t work or something isn’t clear, yell at me because I am 100% responsible.&lt;br /&gt;&lt;br /&gt;GETTING THE SOFTWARE&lt;br /&gt;===============================&lt;br /&gt;&lt;br /&gt;On your Red Hat box, from the directory of your choice, ftp to ftp.nessus.org and login anonymously. Once there, path to /pub/nessus/nessus-2.0.7/nessus-installer/ and download nessus-installer.sh&lt;br /&gt;&lt;br /&gt;INSTALLATION OF THE NESSUS ENGINE&lt;br /&gt;===============================&lt;br /&gt;Now that you have all of the software, it’s time to install. Let’s begin with the Nessus engine because it requires most of the work.&lt;br /&gt;&lt;br /&gt;1. From the directory where you downloaded nessus-installer.sh, simply type: sh nessus-installer.sh. The Nessus installation script will tell you that you need root priviledges to complete the install, press ENTER to continue if you are logged in as root already.&lt;br /&gt;2. Nessus will ask where you want it installed. /usr/local is the default so just hit ENTER when you see the prompt. At this point, Nessus will tell you that it is ready to compile. Hit ENTER and sit back while it compiles. It will take a little while. When it is finished, you’ll see a screen detailing the next steps. Hit ENTER.&lt;br /&gt;3. Now, at this point you have to decide if you want Nessus to start up each time you boot your box or if you just want to start it when you feel like it. To start it when you feel like it, use /usr/local/sbin/nessusd –D. If you want to start it automatically when your box boots up, add /usr/local/sbin/nessusd –D &amp;amp; to /etc/rc.local.&lt;br /&gt;4. Now, decide how you want to handle updating the plugins. You can do it each time the box boots by adding /user/local/sbin/nessus-update-plugins &amp;amp; to /etc/rc.local. You can also copy the nessus-update-plugins script to /etc/cron.daily and it will go out each day and grab the updates.&lt;br /&gt;5. OK, we now have to generate a certificate so go to /usr/local/sbin/ and type nessus-mkcert. This will prompt you for a bunch of information that you would see when generating any SSL certificate. Answer all the questions.&lt;br /&gt;6. Now you have to add a user by running nessus-adduser from /usr/local/sbin. When run, provide a login ID of your choice. When it asks for pass or cert, hit ENTER to accept pass as the auth method. When asked for a password, provide it one. Next you will see a blurb about user rules. Simply hit Ctrl – d and Nessus will verify your input. Type in “y” and Nessus will inform you that the user has been added.&lt;br /&gt;&lt;br /&gt;Well now all you have to do is reboot the box to launch Nessus or you need to start the deamon manually as shown in step 3.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;INSTALLATION OF NESSUSWX CLIENT&lt;br /&gt;===============================&lt;br /&gt;OK, now all you have to do is run the installer. On the first screen, click next to continue. Next click the checkbox if you agree to the license, then hit next to continue. The next screen shows the install path, click next to continue. Select Binaries Only, then click next. The next screen names the program group, hit next to continue. It now has all the info to begin installation. Hit next and it will begin. Once this is done, look for the eyeball icon on your desktop. Launch it. It will ask about a nessusdb and all you need to do is say yes to create it.&lt;br /&gt;&lt;br /&gt;OK, now you need to configure a session:&lt;br /&gt;1) Form the mune pulldowns, select COMMUNICATIONS, then CONNECT. Enter the IP address of your Nessus server then enter the username you created on the Nessus server. You need to use password authentication and it is your choice to save the password or not. Once you do that, hit CONNECT. Accept the certificate however you like (I always do perminant because I trust the source).&lt;br /&gt;2) From the menu pulldowns, select SESSION then NEW.&lt;br /&gt;3) This will open a window to enter your list of target hosts. Add your hosts in here.&lt;br /&gt;4) Now, each tab has tons of options so I will hit on the key ones for now. Hit the portscan tab and enter the range 1-65535.&lt;br /&gt;5) Hit the plug-ins tab and check “use session specific plugin set”, then hit the select plugins button, then select either all plug-ins (bad idea for a production box that you want to scan) or Non-DOS. Click OK.&lt;br /&gt;6) Now, right click on your session (green book icon) and select EXECUTE.&lt;br /&gt;7)  On the next pop-up hit the EXECUTE button and you should see your scan underway.&lt;br /&gt;&lt;br /&gt;At this point, you are golden. When the scan is done you can preview it or you can generate a report. I usually select HTML output.&lt;br /&gt;&lt;br /&gt;In conclusion, I left out *tons* of options and configs but this tutorial is only intended to get you scanning. You’ll need to look into the docs to explore all this tool has to offer.&lt;br /&gt;&lt;br /&gt;Happy scanning!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-4963945465395066928?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/4963945465395066928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=4963945465395066928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4963945465395066928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4963945465395066928'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/vulnerability-scanner-nessus.html' title='Vulnerability Scanner:  Nessus'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-637318361921773542</id><published>2009-05-28T21:52:00.000-07:00</published><updated>2009-05-28T21:55:59.208-07:00</updated><title type='text'>About Mod_Security and Mod_Dosevasive</title><content type='html'>What Are These Two Apache Modules and How Can They Help You?&lt;br /&gt;Apache comes by default as a secure web server. However, that by no means implies that there are no methods of improving its security. On the contrary, there are two primary modules available for Apache that will increase its security strengths ten fold. They are mod_security and  mod_dosevasive.&lt;br /&gt;&lt;br /&gt;It goes without explanation that the internet is a scary, dangerous place. Particularly for web servers, the internet has tons of potential attackers just waiting to attack and cause damage. For this reason, programmers have worked hard to create defense programs and modules, two of the most useful being the Mod_security and Mod_dosevasive modules available for Apache web servers. In the unsafe world of the internet, these modules were created in order to combat hackers and other perpetrators and prevent such attacks as nuke attacks, DoS attacks, and DDoS attacks, amongst others.&lt;br /&gt;&lt;br /&gt;Starting with Mod_dosevasive, which can be easily downloaded from Nuclear Elephant at http://www.nuclearelephant.com/projects/dosevasive/, this module allows for evasive maneuvers in the case of a DoS, DDoS, or similar attack against an Apache web server. This module is most effective when used in conjuction with a firewall or router. It can detect unusually high amounts of requests on the server on a per second basis and prevent these requests, thus evading a potential DoS or DDoS attack by having prevented the attack from consuming bandwith or disk space as it was intended to do. Mod_dosevasive is updated fairly often with improvements to prevent new forms of attacks.&lt;br /&gt;&lt;br /&gt;Mod_security, which can also be downloaded from ModSecurity at http://www.modsecurity.org/, is a constantly updated open source protection utility for servers. It acts in a similar fashion to a firewall, although it is most effective when used in conjuction with a firewall for additional protection, by recognizing and disrupting potential known or unknown server attacks. It comes open source meaning it can be easily edited and customized. Particularly, the module can be customized with specific filtering rules for maximum efficiency.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-637318361921773542?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/637318361921773542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=637318361921773542' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/637318361921773542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/637318361921773542'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/about-modsecurity-and-moddosevasive.html' title='About Mod_Security and Mod_Dosevasive'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-8453741208062735915</id><published>2009-05-28T21:49:00.000-07:00</published><updated>2009-05-28T21:51:04.451-07:00</updated><title type='text'>Apache 1.3 and 2.0 Flood/DoS/DDoS Protection with mod_dosevasive (Avoiding Denial of Service Attacks)</title><content type='html'>&lt;p class="textArialSpacing"&gt;With the widespread infection of many computers with viruses, and the ever increasing number of Botnets, DoS and DDoS attacks can be quite frequent and can very easily bring a website to halt for days. This article provides a module solution for apache to help mitigate small http DoS and DDoS attacks.&lt;/p&gt;       &lt;p class="textArialSpacing"&gt;Download the latest version of mod_dosevasive from: &lt;a href="http://www.nuclearelephant.com/projects/dosevasive" class="linkUnd"&gt;http://www.nuclearelephant.com/projects/dosevasive&lt;/a&gt;&lt;/p&gt;       &lt;p class="textArialSpacing"&gt;The lastest version is 1.10 (&lt;a href="http://www.nuclearelephant.com/projects/dosevasive/mod_dosevasive_1.10.tar.gz" class="linkUnd"&gt;http://www.nuclearelephant.com/projects/dosevasive/mod_dosevasive_1.10.tar.gz&lt;/a&gt;) &lt;/p&gt;       &lt;p class="textArialSpacing"&gt;Untar it:&lt;/p&gt;       &lt;p class="textCodeBlueCourier"&gt;tar zxvf mod_dosevasive_1.10.tar.gz&lt;/p&gt;       &lt;p class="textArialSpacing"&gt;Change into the directory:&lt;/p&gt;       &lt;p class="textCodeBlueCourier"&gt;cd mod_dosevasive&lt;/p&gt;       &lt;p class="textArialSpacing"&gt;Compile mod_dosevasive apache module (Apache 2):&lt;/p&gt;       &lt;p class="textCodeBlueCourier"&gt;/usr/local/apache/bin/apxs -i -a -c mod_dosevasive20.c &lt;/p&gt;       &lt;p class="textArialSpacing"&gt;or the following for apache 1.3:&lt;/p&gt;       &lt;p class="textCodeBlueCourier"&gt;/usr/local/apache/bin/apxs -i -a -c mod_dosevasive.c &lt;/p&gt;       &lt;p class="textArialSpacing"&gt;Replace /usr/local/apache with your path to apache.&lt;/p&gt;       &lt;p class="textArialSpacing"&gt;Edit your httpd.conf (usually located in /usr/local/apache/conf/httpd.conf):&lt;br /&gt;        Add:&lt;br /&gt;       &lt;br /&gt;        &lt;span class="textCodeBlueCourier"&gt;&lt;ifmodule&gt;&lt;br /&gt;DOSHashTableSize 3097&lt;br /&gt;DOSPageCount 2&lt;br /&gt;DOSSiteCount 50&lt;br /&gt;DOSPageInterval 1&lt;br /&gt;DOSSiteInterval 1&lt;br /&gt;DOSBlockingPeriod 10&lt;br /&gt;DOSEmailNotify someuser@somedomain.com&lt;br /&gt;DOSSystemCommand "su - someuser -c '/sbin/... %s ...'"&lt;br /&gt;&lt;/ifmodule&gt; &lt;/span&gt;&lt;/p&gt;       &lt;p class="textArialSpacing"&gt;- DOSHashTableSize: is the size of the table of URL and IP combined&lt;br /&gt;- DOSPageCount: is the number of same page requests from the same IP during an interval that will cause that IP to be added to the block list.&lt;br /&gt;- DOSSiteCount: is the number of pages requested of a site by the same IP during an interval which will cause the IP to be added to the block list.&lt;br /&gt;        - DOSPageInterval: is the interval that the hash table for IPs and URLs is erased (in seconds)&lt;br /&gt;        - DOSSiteInterval: is the intervale that the hash table of IPs is erased (in seconds)&lt;br /&gt;        - DOSBlockingPeriod: is the time the IP is blacked (in seconds)&lt;br /&gt;        - DOSEmailNotify: can be used to notify by sending an email everytime an IP is blocked&lt;br /&gt;- DOSSystemCommand: is the command used to execute a command when an IP is blocked. It can be used to add a block the user from a firewall or router.&lt;br /&gt;        - DOSWhiteList: can be used to whitelist IPs such as 127.0.0.1&lt;/p&gt;       &lt;p class="textArialSpacing"&gt;Although mod_dosevasive can be quite effective in some cases, in others it can cause more problems by blocking non-offending IPs.&lt;/p&gt;&lt;p class="textArialSpacing"&gt;Sylesh&lt;br /&gt;&lt;/p&gt;&lt;p class="textArialSpacing"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="textArialSpacing"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-8453741208062735915?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/8453741208062735915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=8453741208062735915' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/8453741208062735915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/8453741208062735915'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/apache-13-and-20-flooddosddos.html' title='Apache 1.3 and 2.0 Flood/DoS/DDoS Protection with mod_dosevasive (Avoiding Denial of Service Attacks)'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6772483574262481528</id><published>2009-05-26T23:47:00.000-07:00</published><updated>2009-05-26T23:48:11.941-07:00</updated><title type='text'>'netstat' command MAN page</title><content type='html'>netstat    - Print network connections, routing tables, interface statis-&lt;br /&gt;       tics, masquerade connections, and multicast memberships&lt;br /&gt;&lt;br /&gt;SYNOPSIS&lt;br /&gt;&lt;br /&gt;       netstat    [address_family_options]  [--tcp|-t]   [--udp|-u]   [--raw|-w]&lt;br /&gt;       [--listening|-l]     [--all|-a]       [--numeric|-n]    [--numeric-hosts]&lt;br /&gt;       [--numeric-ports]       [--numeric-users]           [--symbolic|-N]&lt;br /&gt;       [--extend|-e[--extend|-e]]  [--timers|-o] [--program|-p] [--verbose|-v]&lt;br /&gt;       [--continuous|-c]&lt;br /&gt;&lt;br /&gt;       netstat            {--route|-r}          [address_family_options]&lt;br /&gt;       [--extend|-e[--extend|-e]]  [--verbose|-v]  [--numeric|-n]  [--numeric-&lt;br /&gt;       hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]&lt;br /&gt;&lt;br /&gt;       netstat {--interfaces|-i} [--all|-a] [--extend|-e[--extend|-e]] [--ver-&lt;br /&gt;       bose|-v]  [--program|-p]  [--numeric|-n]  [--numeric-hosts] [--numeric-&lt;br /&gt;       ports] [--numeric-users] [--continuous|-c]&lt;br /&gt;&lt;br /&gt;       netstat    {--groups|-g}  [--numeric|-n]  [--numeric-hosts]   [--numeric-&lt;br /&gt;       ports] [--numeric-users] [--continuous|-c]&lt;br /&gt;&lt;br /&gt;       netstat     {--masquerade|-M}  [--extend|-e]  [--numeric|-n]  [--numeric-&lt;br /&gt;       hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]&lt;br /&gt;&lt;br /&gt;       netstat {--statistics|-s} [--tcp|-t] [--udp|-u] [--raw|-w]&lt;br /&gt;&lt;br /&gt;       netstat {--version|-V}&lt;br /&gt;&lt;br /&gt;       netstat {--help|-h}&lt;br /&gt;&lt;br /&gt;       address_family_options:&lt;br /&gt;&lt;br /&gt;       [--protocol={inet,unix,ipx,ax25,netrom,ddp}[,...]]       [--unix|-x]&lt;br /&gt;       [--inet|--ip] [--ax25] [--ipx] [--netrom] [--ddp]&lt;br /&gt;&lt;br /&gt;DESCRIPTION&lt;br /&gt;&lt;br /&gt;       Netstat    prints    information about the Linux networking subsystem.  The&lt;br /&gt;       type of information printed is controlled by  the  first  argument,  as&lt;br /&gt;       follows:&lt;br /&gt;&lt;br /&gt;   (none)&lt;br /&gt;       By  default,  netstat  displays    a  list of open sockets.  If you don't&lt;br /&gt;       specify any address families, then the active sockets of all configured&lt;br /&gt;       address families will be printed.&lt;br /&gt;&lt;br /&gt;   --route , -r&lt;br /&gt;       Display the kernel routing tables.&lt;br /&gt;&lt;br /&gt;   --groups , -g&lt;br /&gt;       Display multicast group membership information for IPv4 and IPv6.&lt;br /&gt;&lt;br /&gt;   --interface, -i&lt;br /&gt;       Display a table of all network interfaces.&lt;br /&gt;&lt;br /&gt;   --masquerade , -M&lt;br /&gt;       Display a list of masqueraded connections.&lt;br /&gt;&lt;br /&gt;   --statistics , -s&lt;br /&gt;       Display summary statistics for each protocol.&lt;br /&gt;&lt;br /&gt;OPTIONS&lt;br /&gt;&lt;br /&gt;   --verbose , -v&lt;br /&gt;       Tell  the user what is going on by being verbose. Especially print some&lt;br /&gt;       useful information about unconfigured address families.&lt;br /&gt;&lt;br /&gt;   --numeric , -n&lt;br /&gt;       Show numerical addresses instead of trying to determine symbolic  host,&lt;br /&gt;       port or user names.&lt;br /&gt;&lt;br /&gt;   --numeric-hosts&lt;br /&gt;       shows  numerical  host  addresses but does not affect the resolution of&lt;br /&gt;       port or user names.&lt;br /&gt;&lt;br /&gt;   --numeric-ports&lt;br /&gt;       shows numerical port numbers but does not affect the resolution of host&lt;br /&gt;       or user names.&lt;br /&gt;&lt;br /&gt;   --numeric-users&lt;br /&gt;       shows  numerical user IDs but does not affect the resolution of host or&lt;br /&gt;       port names.&lt;br /&gt;&lt;br /&gt;   --protocol=family , -A&lt;br /&gt;       Specifies the address families (perhaps better described as  low  level&lt;br /&gt;       protocols)  for    which  connections are to be shown.  family is a comma&lt;br /&gt;       (',') separated list of address family keywords like inet,  unix,  ipx,&lt;br /&gt;       ax25,  netrom,  and ddp.  This has the same effect as using the --inet,&lt;br /&gt;       --unix (-x), --ipx, --ax25, --netrom, and --ddp options.&lt;br /&gt;&lt;br /&gt;       The address family inet includes raw, udp and tcp protocol sockets.&lt;br /&gt;&lt;br /&gt;   -c, --continuous&lt;br /&gt;       This will cause netstat to print the selected information every    second&lt;br /&gt;       continuously.&lt;br /&gt;&lt;br /&gt;   -e, --extend&lt;br /&gt;       Display    additional  information.   Use    this  option twice for maximum&lt;br /&gt;       detail.&lt;br /&gt;&lt;br /&gt;   -o, --timers&lt;br /&gt;       Include information related to networking timers.&lt;br /&gt;&lt;br /&gt;   -p, --program&lt;br /&gt;       Show the PID and name of the program to which each socket belongs.&lt;br /&gt;&lt;br /&gt;   -l, --listening&lt;br /&gt;       Show only listening sockets.  (These are omitted by default.)&lt;br /&gt;&lt;br /&gt;   -a, --all&lt;br /&gt;       Show both listening and non-listening sockets.  With  the  --interfaces&lt;br /&gt;       option, show interfaces that are not up&lt;br /&gt;&lt;br /&gt;   -F&lt;br /&gt;       Print routing information from the FIB.    (This is the default.)&lt;br /&gt;&lt;br /&gt;   -C&lt;br /&gt;       Print routing information from the route cache.    UP.&lt;br /&gt;&lt;br /&gt;OUTPUT&lt;br /&gt;&lt;br /&gt;   Active Internet connections (TCP, UDP, raw)&lt;br /&gt;  Proto&lt;br /&gt;       The protocol (tcp, udp, raw) used by the socket.&lt;br /&gt;&lt;br /&gt;   Recv-Q&lt;br /&gt;       The  count  of  bytes  not copied by the user program connected to this&lt;br /&gt;       socket.&lt;br /&gt;&lt;br /&gt;   Send-Q&lt;br /&gt;       The count of bytes not acknowledged by the remote host.&lt;br /&gt;&lt;br /&gt;  Local Address&lt;br /&gt;       Address and port number of the local end of  the  socket.   Unless  the&lt;br /&gt;       --numeric  (-n)    option is specified, the socket address is resolved to&lt;br /&gt;       its canonical host name (FQDN), and the port number is translated  into&lt;br /&gt;       the corresponding service name.&lt;br /&gt;&lt;br /&gt;  Foreign Address&lt;br /&gt;       Address    and port number of the remote end of the socket.  Analogous to&lt;br /&gt;       "Local Address."&lt;br /&gt;&lt;br /&gt;  State&lt;br /&gt;       The state of the socket. Since there are no states in raw mode and usu-&lt;br /&gt;       ally  no  states  used  in UDP, this column may be left blank. Normally&lt;br /&gt;       this can be one of several values:&lt;br /&gt;&lt;br /&gt;       ESTABLISHED&lt;br /&gt;          The socket has an established connection.&lt;br /&gt;&lt;br /&gt;       SYN_SENT&lt;br /&gt;          The socket is actively attempting to establish a connection.&lt;br /&gt;&lt;br /&gt;       SYN_RECV&lt;br /&gt;          A connection request has been received from the network.&lt;br /&gt;&lt;br /&gt;       FIN_WAIT1&lt;br /&gt;          The socket is closed, and the connection is shutting down.&lt;br /&gt;&lt;br /&gt;       FIN_WAIT2&lt;br /&gt;          Connection is closed, and the socket is waiting for  a  shutdown&lt;br /&gt;          from the remote end.&lt;br /&gt;&lt;br /&gt;       TIME_WAIT&lt;br /&gt;          The socket is waiting after close to handle packets still in the&lt;br /&gt;          network.&lt;br /&gt;&lt;br /&gt;       CLOSE  The socket is not being used.&lt;br /&gt;&lt;br /&gt;       CLOSE_WAIT&lt;br /&gt;          The remote end has shut down, waiting for the socket to close.&lt;br /&gt;&lt;br /&gt;       LAST_ACK&lt;br /&gt;          The remote end has shut down, and the socket is closed.  Waiting&lt;br /&gt;          for acknowledgement.&lt;br /&gt;&lt;br /&gt;       LISTEN The  socket is listening for incoming connections.  Such sockets&lt;br /&gt;          are not included in the output unless you specify the  --listen-&lt;br /&gt;          ing (-l) or --all (-a) option.&lt;br /&gt;&lt;br /&gt;       CLOSING&lt;br /&gt;          Both  sockets are shut down but we still don't have all our data&lt;br /&gt;          sent.&lt;br /&gt;&lt;br /&gt;       UNKNOWN&lt;br /&gt;          The state of the socket is unknown.&lt;br /&gt;&lt;br /&gt;  User&lt;br /&gt;       The username or the user id (UID) of the owner of the socket.&lt;br /&gt;&lt;br /&gt;   PID/Program name&lt;br /&gt;       Slash-separated pair of the process id (PID) and process  name  of  the&lt;br /&gt;       process    that  owns  the  socket.   --program  causes this column to be&lt;br /&gt;       included.  You will also need superuser privileges to see this informa-&lt;br /&gt;       tion  on sockets you don't own.    This identification information is not&lt;br /&gt;       yet available for IPX sockets.&lt;br /&gt;&lt;br /&gt;  Timer&lt;br /&gt;       (this needs to be written)&lt;br /&gt;&lt;br /&gt;  Active UNIX domain Sockets&lt;br /&gt;  Proto&lt;br /&gt;       The protocol (usually unix) used by the socket.&lt;br /&gt;&lt;br /&gt;  RefCnt&lt;br /&gt;       The reference count (i.e. attached processes via this socket).&lt;br /&gt;&lt;br /&gt;  Flags&lt;br /&gt;       The flags displayed is SO_ACCEPTON (displayed as ACC), SO_WAITDATA  (W)&lt;br /&gt;       or  SO_NOSPACE  (N).   SO_ACCECPTON  is    used on unconnected sockets if&lt;br /&gt;       their corresponding processes are waiting for a    connect  request.  The&lt;br /&gt;       other flags are not of normal interest.&lt;br /&gt;&lt;br /&gt;  Type&lt;br /&gt;       There are several types of socket access:&lt;br /&gt;&lt;br /&gt;       SOCK_DGRAM&lt;br /&gt;          The socket is used in Datagram (connectionless) mode.&lt;br /&gt;&lt;br /&gt;       SOCK_STREAM&lt;br /&gt;          This is a stream (connection) socket.&lt;br /&gt;&lt;br /&gt;       SOCK_RAW&lt;br /&gt;          The socket is used as a raw socket.&lt;br /&gt;&lt;br /&gt;       SOCK_RDM&lt;br /&gt;          This one serves reliably-delivered messages.&lt;br /&gt;&lt;br /&gt;       SOCK_SEQPACKET&lt;br /&gt;          This is a sequential packet socket.&lt;br /&gt;&lt;br /&gt;       SOCK_PACKET&lt;br /&gt;          Raw interface access socket.&lt;br /&gt;&lt;br /&gt;       UNKNOWN&lt;br /&gt;          Who ever knows what the future will bring us - just fill in here&lt;br /&gt;          :-)&lt;br /&gt;&lt;br /&gt;  State&lt;br /&gt;       This field will contain one of the following Keywords:&lt;br /&gt;&lt;br /&gt;       FREE   The socket is not allocated&lt;br /&gt;&lt;br /&gt;       LISTENING&lt;br /&gt;          The socket is listening for a connection request.  Such  sockets&lt;br /&gt;          are  only  included in the output if you specify the --listening&lt;br /&gt;          (-l) or --all (-a) option.&lt;br /&gt;&lt;br /&gt;       CONNECTING&lt;br /&gt;          The socket is about to establish a connection.&lt;br /&gt;&lt;br /&gt;       CONNECTED&lt;br /&gt;          The socket is connected.&lt;br /&gt;&lt;br /&gt;       DISCONNECTING&lt;br /&gt;          The socket is disconnecting.&lt;br /&gt;&lt;br /&gt;       (empty)&lt;br /&gt;          The socket is not connected to another one.&lt;br /&gt;&lt;br /&gt;       UNKNOWN&lt;br /&gt;          This state should never happen.&lt;br /&gt;&lt;br /&gt;   PID/Program name&lt;br /&gt;       Process ID (PID) and process name of the process that  has  the    socket&lt;br /&gt;       open.  More info available in Active Internet connections section writ-&lt;br /&gt;       ten above.&lt;br /&gt;&lt;br /&gt;  Path&lt;br /&gt;       This is the path name as which the corresponding processes attached  to&lt;br /&gt;       the socket.&lt;br /&gt;&lt;br /&gt;  Active IPX sockets&lt;br /&gt;       (this needs to be done by somebody who knows it)&lt;br /&gt;&lt;br /&gt;   Active NET/ROM sockets&lt;br /&gt;       (this needs to be done by somebody who knows it)&lt;br /&gt;&lt;br /&gt;   Active AX.25 sockets&lt;br /&gt;       (this needs to be done by somebody who knows it)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6772483574262481528?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6772483574262481528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6772483574262481528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6772483574262481528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6772483574262481528'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/netstat-command-man-page.html' title='&apos;netstat&apos; command MAN page'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-52519347396383408</id><published>2009-05-26T23:43:00.000-07:00</published><updated>2009-05-26T23:44:39.239-07:00</updated><title type='text'>'ps' command MAN page</title><content type='html'>ps&lt;br /&gt;&lt;br /&gt;Process status, information about processes running in memory. If you want a repetitive update of this status, use top.&lt;br /&gt;&lt;br /&gt;Syntax&lt;br /&gt;&lt;br /&gt;         ps option(s)&lt;br /&gt;         ps [-L]&lt;br /&gt;&lt;br /&gt;Options&lt;br /&gt;      -L   List all the keyword options&lt;br /&gt;&lt;br /&gt;This version of ps accepts 3 kinds of option:&lt;br /&gt;&lt;br /&gt;-Unix98 options may be grouped and must be preceeded by a dash.&lt;br /&gt;BSD options may be grouped and must not be used with a dash.&lt;br /&gt;--GNU long options are preceeded by two dashes.&lt;br /&gt;&lt;br /&gt;Options of different types may be freely mixed. The PS_PERSONALITY environment variable provides more detailed control of ps behavior.&lt;br /&gt;&lt;br /&gt;The Options below are listed side-by-side (unless there are differences).&lt;br /&gt;&lt;br /&gt;Simple Process Selection:&lt;br /&gt;       -A  a        select all processes (including those of other users)&lt;br /&gt;       -a           select all with a tty except session leaders&lt;br /&gt;       -d           select all, but omit session leaders&lt;br /&gt;       -e           select all processes&lt;br /&gt;       g            really all, even group leaders (does nothing w/o SunOS settings)&lt;br /&gt;       -N           negate selection&lt;br /&gt;       r            restrict output to running processes&lt;br /&gt;       T            select all processes on this terminal&lt;br /&gt;       x            select processes without controlling ttys&lt;br /&gt;       --deselect   negate selection&lt;br /&gt;&lt;br /&gt;Process Selection by List:&lt;br /&gt;&lt;br /&gt;     -C              select by command name&lt;br /&gt;     -G              select by RGID (supports names)&lt;br /&gt;     -g              select by session leader OR by group name&lt;br /&gt;            --Group  select by real group name or ID&lt;br /&gt;            --group  select by effective group name or ID&lt;br /&gt;     -p  p  --pid    select by process ID (PID)&lt;br /&gt;     -s     --sid    select by session ID&lt;br /&gt;     -t     --tty    select by terminal (tty)&lt;br /&gt;     -u  U           select by effective user ID (supports names)&lt;br /&gt;     -U              select by RUID (supports names)&lt;br /&gt;            --User   select by real user name or ID&lt;br /&gt;            --user   select by effective user name or ID&lt;br /&gt;&lt;br /&gt;     -123      implied --sid&lt;br /&gt;     123       implied --pid&lt;br /&gt;&lt;br /&gt;Output Format Control:&lt;br /&gt;&lt;br /&gt;       -c         Different scheduler info for -l option&lt;br /&gt;       -f         Full listing&lt;br /&gt;       -j  j      Jobs format&lt;br /&gt;       -l  l      Long format&lt;br /&gt;       -O  O      Add the information associated with the space or comma separated&lt;br /&gt;                  list of keywords specified, after the process ID, in the default&lt;br /&gt;                  information display.&lt;br /&gt;&lt;br /&gt;       -o  o      Display information associated with the space or comma separated&lt;br /&gt;                  list of keywords specified.&lt;br /&gt;       --format   user-defined format&lt;br /&gt;        s         display signal format&lt;br /&gt;        u         display user-oriented format&lt;br /&gt;        v         display virtual memory format&lt;br /&gt;        X         old Linux i386 register format&lt;br /&gt;       -y         do not show flags; show rss in place of addr&lt;br /&gt;&lt;br /&gt;Output Modifiers:&lt;br /&gt;       C              use raw CPU time for %CPU instead of decaying average&lt;br /&gt;       c              true command name&lt;br /&gt;       e              show environment after the command&lt;br /&gt;       f              ASCII-art process hierarchy (forest)&lt;br /&gt;       -H             show process hierarchy (forest)&lt;br /&gt;       h              do not print header lines (repeat header lines in BSD personality)&lt;br /&gt;       -m  m          show all threads&lt;br /&gt;       -n             set namelist file&lt;br /&gt;       n              numeric output for WCHAN and USER&lt;br /&gt;       N              specify namelist file&lt;br /&gt;       O              sorting order (overloaded)&lt;br /&gt;       S              include some dead child process data (as a  sum  with the parent)&lt;br /&gt;       -w  w          wide output&lt;br /&gt;       --cols         set screen width&lt;br /&gt;       --columns      set screen width&lt;br /&gt;       --forest       ASCII art process tree&lt;br /&gt;       --html         HTML escaped output&lt;br /&gt;       --headers      repeat header lines&lt;br /&gt;       --no-headers   print no header line at all&lt;br /&gt;       --lines        set screen height&lt;br /&gt;       --nul          unjustified output with NULs&lt;br /&gt;       --null         unjustified output with NULs&lt;br /&gt;       --rows         set screen height&lt;br /&gt;       --sort         specify sorting order&lt;br /&gt;       --width        set screen width&lt;br /&gt;       --zero         unjustified output with NULs&lt;br /&gt;&lt;br /&gt;Information:&lt;br /&gt;       -V  V       print version&lt;br /&gt;       L           list all format specifiers&lt;br /&gt;       --help      print help message&lt;br /&gt;       --info      print debugging info&lt;br /&gt;       --version   print version&lt;br /&gt;&lt;br /&gt;Obsolete:&lt;br /&gt;       A        increase the argument space (DecUnix)&lt;br /&gt;       M        use alternate core (try -n or N instead)&lt;br /&gt;       W        get swap info from ... not /dev/drum (try -n or N instead)&lt;br /&gt;       k        use /vmcore as c-dumpfile (try -n or N instead)&lt;br /&gt;&lt;br /&gt;NOTES&lt;br /&gt;The "-g" option can select by session leader OR by group name. Selection by session leader is specified by many standards, but selection by group is the logical behavior that several other operating systems use. This ps will select by session leader when the list is completely numeric (as sessions are). Group ID numbers will work only when some group names are also specified.&lt;br /&gt;&lt;br /&gt;The "m" option should not be used. Use "-m" or "-o" with a list. ("m" displays memory info, shows threads, or sorts by memory use)&lt;br /&gt;&lt;br /&gt;The "h" option varies between BSD personality and Linux usage (not printing the header) Regardless of the current personality, you can use the long options --headers and --no-headers&lt;br /&gt;&lt;br /&gt;Terminals (ttys, or screens of text output) can be specified in several forms: /dev/ttyS1, ttyS1, S1. Obsolete "ps t" (your own terminal) and "ps t?" (processes without a terminal) syntax is supported, but modern options ("T","-t" with list, "x", "t" with list) should be used instead.&lt;br /&gt;&lt;br /&gt;The BSD "O" option can act like "-O" (user-defined output format with some common fields predefined) or can be used to specify sort order. Heuristics are used to determine the behavior of this option. To ensure that the desired behavior is obtained, specify the other option (sorting or formatting) in some other way.&lt;br /&gt;&lt;br /&gt;For sorting, BSD "O" option syntax is O[+|-]k1[,[+|-]k2[,...]] Order the process listing according to the multilevel sort specified by the sequence of short keys from SORT KEYS, k1, k2, ... The `+' is quite optional, merely re-iterating the default direction on a key. `-' reverses direction only on the key it precedes.&lt;br /&gt;The O option must be the last option in a single command argument, but specifications in successive arguments are catenated.&lt;br /&gt;&lt;br /&gt;GNU sorting syntax is --sortX[+|-]key[,[+|-]key[,...]]&lt;br /&gt;Choose a multi-letter key from the SORT KEYS section. X may be any convenient separator character. To be GNU-ish use `='. The `+' is really optional since default direction is increasing numerical or lexicographic order. For example, ps jax --sort=uid,-ppid,+pid&lt;br /&gt;&lt;br /&gt;This ps works by reading the virtual files in /proc. This ps does not need to be suid kmem or have any privileges to run. Do not give this ps any special permissions.&lt;br /&gt;&lt;br /&gt;This ps needs access to a namelist file for proper WCHAN display. The namelist file must match the current Linux kernel exactly for correct output.&lt;br /&gt;&lt;br /&gt;To produce the WCHAN field, ps needs to read the System.map file created when the kernel is compiled. The search path is:&lt;br /&gt;&lt;br /&gt;   $PS_SYSTEM_MAP&lt;br /&gt;   /boot/System.map-`uname -r`&lt;br /&gt;   /boot/System.map&lt;br /&gt;   /lib/modules/`uname -r`/System.map&lt;br /&gt;   /usr/src/linux/System.map&lt;br /&gt;   /System.map&lt;br /&gt;&lt;br /&gt;The member used_math of task_struct is not shown, since crt0.s checks to see if math is present. This causes the math flag to be set for all processes, and so it is Programs swapped out to disk will be shown without command line arguments, and unless the c option is given, in brackets.&lt;br /&gt;&lt;br /&gt;%CPU shows the cputime/realtime percentage. It will not add up to 100% unless you are lucky. It is time used divided by the time the process has been running.&lt;br /&gt;&lt;br /&gt;The SIZE and RSS fields don't count the page tables and the task_struct of a proc; this is at least 12k of memory that is always resident. SIZE is the virtual size of the proc (code+data+stack).&lt;br /&gt;&lt;br /&gt;Processes marked are dead processes (so-called"zombies") that remain because their parent has not destroyed them properly. These processes will be destroyed by init(8) if the parent process exits.&lt;br /&gt;&lt;br /&gt;   PROCESS FLAGS&lt;br /&gt;       ALIGNWARN    001   print alignment warning msgs&lt;br /&gt;       STARTING     002   being created&lt;br /&gt;       EXITING      004   getting shut down&lt;br /&gt;       PTRACED      010   set if ptrace (0) has been called&lt;br /&gt;       TRACESYS     020   tracing system calls&lt;br /&gt;       FORKNOEXEC   040   forked but didn't exec&lt;br /&gt;       SUPERPRIV    100   used super-user privileges&lt;br /&gt;       DUMPCORE     200   dumped core&lt;br /&gt;       SIGNALED     400   killed by a signal&lt;br /&gt;&lt;br /&gt;   PROCESS STATE CODES&lt;br /&gt;       D   uninterruptible sleep (usually IO)&lt;br /&gt;       R   runnable (on run queue)&lt;br /&gt;       S   sleeping&lt;br /&gt;       T   traced or stopped&lt;br /&gt;       Z   a defunct ("zombie") process&lt;br /&gt;&lt;br /&gt;       For BSD formats and when the "stat" keyword is used, addi­&lt;br /&gt;       tional letters may be displayed:&lt;br /&gt;       W   has no resident pages&lt;br /&gt;       &lt;   high-priority process&lt;br /&gt;       N   low-priority task&lt;br /&gt;       L   has pages locked into memory (for real-time and custom IO)&lt;br /&gt;&lt;br /&gt;ENVIRONMENT VARIABLES and PERSONALITY (posix,linux,bsd,sun)&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;List every process on the system using standard syntax:&lt;br /&gt;ps -e&lt;br /&gt;&lt;br /&gt;List every process on the system using BSD syntax:&lt;br /&gt;ps ax&lt;br /&gt;&lt;br /&gt;List the top 10 CPU users.&lt;br /&gt;ps -e -o pcpu -o pid -o user -o args | sort -k 1 | tail -21r&lt;br /&gt;&lt;br /&gt;List every process except those running as root (real &amp;amp; effective ID)&lt;br /&gt;ps -U root -u root -N&lt;br /&gt;&lt;br /&gt;List every process with a user-defined format:&lt;br /&gt;ps -eo pid,tt,user,fname,tmout,f,wchan&lt;br /&gt;&lt;br /&gt;Odd display with AIX field descriptors:&lt;br /&gt;ps -o "%u : %U : %p : %a"&lt;br /&gt;&lt;br /&gt;Print only the process IDs of syslogd:&lt;br /&gt;ps -C syslogd -o pid=&lt;br /&gt;&lt;br /&gt;When displaying multiple fields, part of the output may be truncated, to avoid this supply a width to the arguments:&lt;br /&gt;&lt;br /&gt;ps -e -o user:20,args.&lt;br /&gt;&lt;br /&gt;Since ps cannot run faster than the system and is run as any other scheduled process, the information it displays can never be exact.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-52519347396383408?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/52519347396383408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=52519347396383408' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/52519347396383408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/52519347396383408'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/ps-command-man-page.html' title='&apos;ps&apos; command MAN page'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3822970789731046204</id><published>2009-05-26T23:35:00.000-07:00</published><updated>2009-05-26T23:36:58.128-07:00</updated><title type='text'>'.htaccess'  file in detail</title><content type='html'>htaccess (Hypertext Access) is the default name of Apache’s directory-level configuration file. It provides the ability to customize configuration directives defined in the main configuration file. The configuration directives need to be in .htaccess context and the user needs appropriate permissions.&lt;br /&gt;&lt;br /&gt;Statements such as the following can be used to configure a server to send out customized documents in response to client errors such as “404: Not Found” or server errors such as “503: Service Unavailable” (see List of HTTP status codes):&lt;br /&gt;&lt;br /&gt;ErrorDocument 404 /error-pages/not-found.html&lt;br /&gt;ErrorDocument 503 /error-pages/service-unavailable.html&lt;br /&gt;&lt;br /&gt;When setting up custom error pages, it is important to remember that these pages may be accessed from various different URLs, so the links in these error documents (including those to images, stylesheets and other documents) must be specified using URLs that are either absolute (e.g., starting with “http://”) or relative to the document root (starting with “/”). Also, the error page for “403: Forbidden” errors must be placed in a directory that is accessible to users who are denied access to other parts of the site. This is typically done by making the directory containing the error pages accessible to everyone by creating another .htaccess file in the /error-pages directory containing these lines:&lt;br /&gt;&lt;br /&gt;Order allow,deny&lt;br /&gt;Allow from all&lt;br /&gt;&lt;br /&gt;Password protection&lt;br /&gt;&lt;br /&gt;Make the user enter a name and password before viewing a directory.&lt;br /&gt;&lt;br /&gt;AuthUserFile /home/newuser/www/stash/.htpasswd&lt;br /&gt;AuthGroupFile /dev/null&lt;br /&gt;AuthName "Protected Directory"&lt;br /&gt;AuthType Basic&lt;br /&gt;&lt;limit get="" post=""&gt;&lt;br /&gt;require user newuser&lt;br /&gt;&lt;/limit&gt;&lt;br /&gt;&lt;br /&gt;The same behavior can be applied to specific files inside a directory.&lt;br /&gt;&lt;br /&gt;&lt;files php=""&gt;&lt;br /&gt;AuthUserFile /home/newuser/www/stash/.htpasswd&lt;br /&gt;AuthName "Protected File"&lt;br /&gt;AuthType Basic&lt;br /&gt;Require valid-user&lt;br /&gt;&lt;/files&gt;&lt;br /&gt;&lt;br /&gt;Now run this command to create a new password for the user ‘newuser’.&lt;br /&gt;&lt;br /&gt;htpasswd /home/newuser/www/stash/.htpasswd newuser&lt;br /&gt;&lt;br /&gt;Password unprotection&lt;br /&gt;&lt;br /&gt;Unprotect a directory inside an otherwise protected structure:&lt;br /&gt;&lt;br /&gt;Satisfy any&lt;br /&gt;&lt;br /&gt;Extra secure method to force a domain to only use SSL and fix double login problem&lt;br /&gt;&lt;br /&gt;If you really want to be sure that your server is only serving documents over an encrypted SSL channel (you wouldn’t want visitors to submit a htaccess password prompt on an unencrypted connection) then you need to use the SSLRequireSSL directive with the +StrictRequire Option turned on.&lt;br /&gt;&lt;br /&gt;SSLOptions +StrictRequire&lt;br /&gt;SSLRequireSSL&lt;br /&gt;SSLRequire %{HTTP_HOST} eq "site.com" #or www.site.com&lt;br /&gt;ErrorDocument 403 https://site.com&lt;br /&gt;&lt;br /&gt;An interesting thing when using the mod_ssl instead of mod_rewrite to force SSL is that apache give mod_ssl priority ABOVE mod_rewrite so it will always require SSL. (may be able to get around first method using http://site.com:443 or https://site.com:80)&lt;br /&gt;&lt;br /&gt;   * An in-depth article about what this is doing can be found in the SSL Forum&lt;br /&gt;&lt;br /&gt;Enable SSI&lt;br /&gt;&lt;br /&gt;AddType text/html .shtml&lt;br /&gt;AddHandler server-parsed .shtml&lt;br /&gt;Options Indexes FollowSymLinks Includes&lt;br /&gt;&lt;br /&gt;Deny users by IP address&lt;br /&gt;&lt;br /&gt;Order allow,deny&lt;br /&gt;Deny from 123.45.67.8&lt;br /&gt;Deny from 123.123.7&lt;br /&gt;Allow from all&lt;br /&gt;&lt;br /&gt;   This would ban anyone with an IP address of 123.45.67.8 and would also ban anyone with an IP address starting in 123.123.7: for example, 123.123.74.42 would not gain access.&lt;br /&gt;&lt;br /&gt;Change the default directory page&lt;br /&gt;&lt;br /&gt;DirectoryIndex homepage.html&lt;br /&gt;&lt;br /&gt;   Here, anyone visiting http://www.example.com/ would see the homepage.html page, rather than the default index.html.&lt;br /&gt;&lt;br /&gt;Redirects&lt;br /&gt;&lt;br /&gt;Redirect page1.html page2.html&lt;br /&gt;&lt;br /&gt;   If someone were to visit http://www.example.com/page1.html, he would be sent (with an HTTP status code of 302) to http://www.example.com/page2.html&lt;br /&gt;&lt;br /&gt;Prevent hotlinking of images&lt;br /&gt;&lt;br /&gt;The following .htaccess rules use mod rewrite.&lt;br /&gt;From specific domains&lt;br /&gt;&lt;br /&gt;RewriteEngine on&lt;br /&gt;RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?baddomain1\.com [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?baddomain2\.com [NC,OR]&lt;br /&gt;RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?baddomain3\.com [NC]&lt;br /&gt;RewriteRule \.(gif|jpg)$ http://www.example.com/hotlink.gif [R,L]&lt;br /&gt;&lt;br /&gt;Except from specific domains&lt;br /&gt;&lt;br /&gt;RewriteEngine on&lt;br /&gt;RewriteCond %{HTTP_REFERER} !^$&lt;br /&gt;RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]&lt;br /&gt;RewriteRule \.(gif|jpg)$ http://www.example.com/hotlink.gif [R,L]&lt;br /&gt;&lt;br /&gt;   Unless the image is displayed on example.com, browers would see the image hotlink.gif.&lt;br /&gt;&lt;br /&gt;Note: Hotlink protection using .htaccess relies on the client sending the correct “Referer” value in the http GET request. Programs such as Windows Media Player send a blank referrer, so that attempts to use .htaccess to protect movie files for example are ineffective.&lt;br /&gt;Standardise web address to require www with SEO-friendly 301 Redirect&lt;br /&gt;&lt;br /&gt;If an address without the “www.” prefix is entered, this will redirect to the page with the “www.” prefix.&lt;br /&gt;&lt;br /&gt;Options +FollowSymLinks&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteBase /&lt;br /&gt;RewriteCond %{HTTP_HOST} !^$       #check that HTTP_HOST field is present&lt;br /&gt;RewriteCond %{HTTP_HOST} !^www\.sitename\.com$ [NC] #case-insensitive&lt;br /&gt;RewriteRule ^(.*)$ http://www.sitename.com/$1 [R=301,L] #301 Redirect, very efficient&lt;br /&gt;&lt;br /&gt;See the Ultimate htaccess File for more examples..&lt;br /&gt;Directory rules&lt;br /&gt;&lt;br /&gt;A .htaccess file controls the directory it is in, plus all subdirectories. However, by placing additional .htaccess files in the subdirectories, this can be overruled.&lt;br /&gt;User permissions&lt;br /&gt;&lt;br /&gt;The user permissions for .htaccess are controlled on server level with the AllowOverride directive which is documented in the Apache Server Documentation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3822970789731046204?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3822970789731046204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3822970789731046204' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3822970789731046204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3822970789731046204'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/htaccess-file-in-detail.html' title='&apos;.htaccess&apos;  file in detail'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-1482924588416437345</id><published>2009-05-15T06:59:00.000-07:00</published><updated>2009-05-15T07:03:41.997-07:00</updated><title type='text'>Custom PHP.ini and .htaccess rules</title><content type='html'>Describes in exhaustive detail how to change configuration settings and implement a custom php.ini file for use with the Apache Web Server.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Sections:&lt;/h2&gt; &lt;ul&gt;&lt;li&gt;When php run as Apache Module (mod_php)&lt;/li&gt;&lt;li&gt;When php run as CGI&lt;/li&gt;&lt;li&gt;When cgi?d php is run with wrapper (for FastCGI)&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;.htaccess code from &lt;a href="http://www.askapache.com/htaccess/ultimate-htaccess-file-sample.html"&gt;Ultimate htaccess file&lt;/a&gt;&lt;/h2&gt; &lt;h3&gt;RUN PHP AS APACHE MODULE&lt;/h3&gt; &lt;pre&gt;AddHandler application/x-httpd-php .php .htm&lt;br /&gt;&lt;/pre&gt; &lt;h3&gt;RUN PHP AS CGI&lt;/h3&gt; &lt;pre&gt;AddHandler php-cgi .php .htm&lt;br /&gt;&lt;/pre&gt; &lt;h3&gt;CGI PHP WRAPPER FOR CUSTOM PHP.INI&lt;/h3&gt; &lt;pre&gt;AddHandler phpini-cgi .php .htm&lt;br /&gt;Action phpini-cgi /cgi-bin/php5-custom-ini.cgi&lt;br /&gt;&lt;/pre&gt; &lt;h3&gt;FAST-CGI SETUP WITH PHP-CGI WRAPPER FOR CUSTOM PHP.INI&lt;/h3&gt; &lt;pre&gt;AddHandler fastcgi-script .fcgi&lt;br /&gt;AddHandler php-cgi .php .htm&lt;br /&gt;Action php-cgi /cgi-bin/php5-wrapper.fcgi&lt;br /&gt;&lt;/pre&gt; &lt;h3&gt;CUSTOM PHP CGI BINARY SETUP&lt;/h3&gt; &lt;pre&gt;AddHandler php-cgi .php .htm&lt;br /&gt;Action php-cgi /cgi-bin/php.cgi&lt;br /&gt;&lt;/pre&gt; &lt;h2&gt;When php run as Apache Module (mod_php)&lt;/h2&gt; &lt;p&gt;in root .htaccess&lt;/p&gt; &lt;pre&gt;SetEnv PHPRC /location/todir/containing/phpinifile&lt;br /&gt;&lt;/pre&gt; &lt;h2&gt;When php run as CGI&lt;/h2&gt; &lt;p&gt;Place your php.ini file in the dir of your cgi’d php, in this case /cgi-bin/&lt;/p&gt; &lt;p&gt;htaccess might look something like this&lt;/p&gt; &lt;pre&gt;AddHandler php-cgi .php .htm&lt;br /&gt;Action php-cgi /cgi-bin/php5.cgi&lt;br /&gt;&lt;/pre&gt; &lt;h2&gt;When php is run as cgi&lt;/h2&gt; &lt;p&gt;Create a wrapper script called phpini.cgi to export the directory that contains the &lt;strong&gt;php.ini file&lt;/strong&gt; as &lt;strong&gt;PHPRC&lt;/strong&gt;&lt;/p&gt; &lt;pre&gt;#!/bin/sh&lt;br /&gt;export PHPRC=/home/site/askapache.com/inc&lt;br /&gt;exec /user/htdocs/cgi-bin/php5.cgi&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;In your .htaccess or httpd.conf file&lt;/p&gt; &lt;pre&gt;AddHandler php-cgi .php&lt;br /&gt;Action php-cgi /cgi-bin/phpini.cgi&lt;br /&gt;&lt;/pre&gt; &lt;h2&gt;When cgi’d php is run with wrapper (for FastCGI)&lt;/h2&gt; &lt;p&gt;&lt;a href="http://www.askapache.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost.html"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;You will have a shell wrapper script something like this:&lt;/p&gt; &lt;pre&gt;#!/bin/sh&lt;br /&gt;export PHP_FCGI_CHILDREN=3&lt;br /&gt;exec /user/htdocs/cgi-bin/php5.cgi&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;Change To&lt;/p&gt; &lt;pre&gt;#!/bin/sh&lt;br /&gt;export PHP_FCGI_CHILDREN=3&lt;br /&gt;exec /user/htdocs/cgi-bin/php.cgi -c /home/user/php.ini&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;strong&gt;NOTES:&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Since PHP 5.1.0, it is possible to refer to existing .ini variables from within .ini files. &lt;code&gt;open_basedir = ${open_basedir} ":/new/dir"&lt;/code&gt;&lt;/li&gt;&lt;li&gt;In order for PHP to read it, config file must be named php.ini&lt;/li&gt;&lt;li&gt;SetEnv PHPRC only works when using PHP as CGI, not when using php as an Apache Module&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;Default locations to look for php.ini&lt;/h2&gt;PHP looks for custom php.ini in this order:&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;In the Current working directory&lt;/h3&gt; &lt;ol&gt;&lt;li&gt;Place your php.ini in the same directory as the php executable.&lt;/li&gt;&lt;li&gt;If php executable is here: /home/user1/htdocs/cgi-bin/ &lt;/li&gt;&lt;li&gt;then place your php.ini file here: /home/user1/htdocs/cgi-bin/php.ini&lt;/li&gt;&lt;/ol&gt; &lt;h3&gt;In the path specified by the environment variable &lt;strong&gt;PHPRC&lt;/strong&gt;&lt;/h3&gt; &lt;ol&gt;&lt;li&gt;If you can use SetEnv in .htaccess files–&gt; in the root .htaccess file specify the path to the &lt;strong&gt;directory&lt;/strong&gt; containing php.ini &lt;code&gt;SetEnv PHPRC /home/user1&lt;/code&gt;&lt;/li&gt;&lt;li&gt;If you can’t use SetEnv and you are using a wrapper shell script place this in your wrapper shell script &lt;code&gt;export PHPRC=/home/user1&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt; &lt;h3&gt;In the path that was defined at compile time with &lt;strong&gt;–with-config-file-path&lt;/strong&gt;&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;The path in which the php.ini file is looked for &lt;strong&gt;can be overridden using the -c argument&lt;/strong&gt; in command line mode. (cgi) &lt;code&gt;/home/user1/htdocs/cgi-bin/php.cgi -c /home/user1/php.ini&lt;/code&gt;&lt;/li&gt;&lt;li&gt;With this option one can either specify a directory where to look for php.ini or you can specify a custom INI file directly (which does &lt;strong&gt;not need to be named php.ini&lt;/strong&gt;),&lt;code&gt;$ php -c /custom/directory/custom-file.ini my_script.php&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Under Windows, the compile-time path is the Windows directory. Place php.ini in one of the directories, &lt;code&gt;C:\windows or C:\winnt&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;php.ini is searched for in these locations in this order&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; The Apache web server changes the directory to root at startup causing PHP to attempt to read php.ini from the root filesystem if it exists. If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is e.g. php-cli.ini or php-apache.ini), it’s used instead of php.ini. SAPI name can be determined by php_sapi_name(). You can use also use the predefined PHP_SAPI constant instead of php_sapi_name()&lt;/p&gt; &lt;p&gt;Read this article: &lt;a href="http://www.apachelounge.com/forum/viewtopic.php?t=570"&gt;If your server is running Windows&lt;/a&gt;&lt;/p&gt; &lt;ol&gt;&lt;li&gt;SAPI module specific location &lt;ul&gt;&lt;li&gt;&lt;strong&gt;PHPIniDir&lt;/strong&gt; directive in Apache 2&lt;/li&gt;&lt;li&gt;&lt;strong&gt;-c&lt;/strong&gt; command line option in CGI and CLI&lt;/li&gt;&lt;li&gt;&lt;strong&gt;php_ini&lt;/strong&gt; parameter in NSAPI&lt;/li&gt;&lt;li&gt;&lt;strong&gt;PHP_INI_PATH&lt;/strong&gt; environment variable in THTTPD&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li&gt;The &lt;strong&gt;PHPRC&lt;/strong&gt; environment variable &lt;em&gt;(Before PHP 5.2.0 this was checked after the registry key mentioned below.)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath &lt;em&gt;(Windows Registry location)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Current working directory &lt;em&gt;(for CLI)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;The web server’s directory &lt;em&gt;(for SAPI modules)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Directory of PHP &lt;em&gt;(If Windows)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Windows directory &lt;em&gt;(C:\windows or C:\winnt)&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;–with-config-file-path&lt;/strong&gt; compile time option&lt;/li&gt;&lt;/ol&gt; &lt;h2&gt;Directions for custom php.ini for Powweb Customers&lt;/h2&gt; &lt;p&gt;Specific to Powweb, but can be used elsewhere.&lt;/p&gt; &lt;pre&gt;SetEnv PHPRC /home/users/web/bEXAMPLE/pow.EXAMPLE&lt;br /&gt;&lt;/pre&gt; &lt;ol&gt;&lt;li&gt;In the folder above the htdocs (your ROOT) for the domain you want a custom php.ini file for, create an htaccess file with the above content:&lt;/li&gt;&lt;li&gt;Then create a blank php.ini also in your ROOT directory (/home/users/web/bEXAMPLE/pow.EXAMPLE). Next copy the powweb php.ini text to your php.ini file and customize it.&lt;/li&gt;&lt;li&gt;You can test to make sure you are using the new php.ini by running phpinfo(); If you want multiple php.ini files, then use .htaccess files to set the PHPRC variable to the directory that the php.ini file you want to use is in.&lt;/li&gt;&lt;/ol&gt; &lt;h3&gt;File structure from ROOT directory&lt;/h3&gt; &lt;pre&gt;.&lt;br /&gt;|-- site1.com&lt;br /&gt;|   `-- htdocs&lt;br /&gt;|   |   |-- cgi-bin&lt;br /&gt;|   |   |   `-- dl.cgi&lt;br /&gt;|   |   `-- index.html&lt;br /&gt;|   |-- phpsessions&lt;br /&gt;|   |-- php.ini&lt;br /&gt;|   `-- .htaccess&lt;br /&gt;|-- site2.org&lt;br /&gt;|   `-- htdocs&lt;br /&gt;|   |   |-- cgi-bin&lt;br /&gt;|   |   |   `-- dl.cgi&lt;br /&gt;|   |   `-- index.html&lt;br /&gt;|   |-- phpsessions&lt;br /&gt;|   |-- php.ini&lt;br /&gt;|   `-- .htaccess&lt;br /&gt;`-- site3.net&lt;br /&gt;`-- htdocs&lt;br /&gt;|   |-- cgi-bin&lt;br /&gt;|   |   `-- dl.cgi&lt;br /&gt;|   `-- index.html&lt;br /&gt;|-- phpsession&lt;br /&gt;|-- php.ini&lt;br /&gt;`-- .htaccess&lt;br /&gt;&lt;/pre&gt; &lt;h3&gt;Powweb File Permissions&lt;/h3&gt; &lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt; to chmod 640 all .htaccess files, chmod 600 your php.ini files, chmod 600 your php flies, and chmod 705 your cgi scripts.. if you don’t want ftp users to be able to change the file than chmod 400.&lt;/p&gt; &lt;h2&gt;PHP-CGI vs. MOD_PHP&lt;/h2&gt; &lt;p&gt;&lt;q&gt;&lt;strong&gt;What’s the difference between PHP-CGI and PHP as an Apache module?&lt;/strong&gt;&lt;/q&gt;&lt;/p&gt; &lt;h3&gt;Benefits of PHP-CGI&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;php-cgi is more secure. The PHP runs as your user rather than dhapache. That means you can put your database passwords in a file readable only by you and your php scripts can still access it!&lt;/li&gt;&lt;li&gt;php-cgi is more flexible. Because of security concerns when running PHP as an Apache module, we disabled commands with the non-CGI PHP. This will cause install problems with certain popular PHP scripts if you run PHP not as a CGI!&lt;/li&gt;&lt;li&gt;php-cgi is just as fast as running PHP as an Apache module, and we include more default libraries. &lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Caveats of PHP-CGI&lt;/h3&gt; &lt;p&gt;If one of these is a show-stopper for you, you can easily switch to running PHP as an Apache module and not CGI, but be prepared for a bunch of potential security and ease-of-use issues! If you don’t know what any of these drawbacks mean, you’re fine just using the default setting of PHP-CGI and not worrying about anything!&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Variables in the URL which are not regular &lt;code&gt;?foo=bar&lt;/code&gt; variables won’t work without using (&lt;a href="http://httpd.apache.org/docs/mod/mod_rewrite.html"&gt;mod_rewrite&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;Custom php directives in .htaccess files &lt;code&gt;(php_include_dir /home/user;/home/user/example_dir)&lt;/code&gt; won’t work.&lt;/li&gt;&lt;li&gt;The &lt;code&gt;$_SERVER['SCRIPT_NAME']&lt;/code&gt; variable will return the php.cgi binary rather than the name of your script&lt;/li&gt;&lt;li&gt;Persistant database connections will not work. PHP’s &lt;code&gt;mysql_pconnect()&lt;/code&gt; function will just open a new connection because it can’t find a persistant one.&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;PHP’s configuration file&lt;/h2&gt; &lt;p&gt;&lt;a href="http://php.net/manual/en/configuration.php"&gt;The configuration file&lt;/a&gt; (called &lt;code&gt;php3.ini&lt;/code&gt; in PHP 3, and simply &lt;code&gt;php.ini&lt;/code&gt; as of PHP 4) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. &lt;strong&gt;Note:&lt;/strong&gt; For the CGI and CLI version, php.ini is read on every invocation.&lt;/p&gt; &lt;h2&gt;Running PHP as Apache module (mod_php)&lt;/h2&gt; &lt;p&gt;When using PHP as an Apache module, you can also change the configuration settings using directives in Apache configuration files (e.g. &lt;code&gt;httpd.conf&lt;/code&gt;) and &lt;code&gt;.htaccess&lt;/code&gt; files. You will need one of these privileges:&lt;/p&gt; &lt;pre&gt;AllowOverride Options&lt;br /&gt;AllowOverride All&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;With PHP 4 and PHP 5, there are several Apache directives that allow you to change the PHP configuration from within the Apache configuration files.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; With PHP 3, there are Apache directives that correspond to each configuration setting in the php3.ini name, except the name is prefixed by “php3_”.&lt;/p&gt; &lt;dl&gt;&lt;dt&gt;&lt;strong&gt;&lt;code&gt;php_value name value&lt;/code&gt;&lt;/strong&gt;&lt;/dt&gt;&lt;dd&gt;Sets the value of the specified directive. Can be used only with &lt;code&gt;PHP_INI_ALL&lt;/code&gt; and &lt;code&gt;PHP_INI_PERDIR&lt;/code&gt; type directives. To clear a previously set value use &lt;code&gt;none&lt;/code&gt; as the value.&lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;&lt;code&gt;php_flag name on|off&lt;/code&gt;&lt;/strong&gt;&lt;/dt&gt;&lt;dd&gt;Used to set a boolean configuration directive. Can be used only with &lt;code&gt;PHP_INI_ALL&lt;/code&gt; and &lt;code&gt;PHP_INI_PERDIR&lt;/code&gt; type directives.&lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;&lt;code&gt;php_admin_value name value&lt;/code&gt;&lt;/strong&gt;&lt;/dt&gt;&lt;dd&gt;Sets the value of the specified directive. This can not be used in .htaccess files. Any directive type set with php_admin_value can not be overridden by .htaccess or virtualhost directives. To clear a previously set value use none as the value.&lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;&lt;code&gt;php_admin_flag name on|off&lt;/code&gt;&lt;/strong&gt;&lt;/dt&gt;&lt;dd&gt;Used to set a boolean configuration directive. This can not be used in .htaccess files. Any directive type set with php_admin_flag can not be overridden by .htaccess or virtualhost directives.&lt;/dd&gt;&lt;/dl&gt; &lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Don’t use php_value to set boolean values. use php_flag instead.&lt;/p&gt; &lt;h2&gt;Change php settings in .htaccess or httpd.conf&lt;/h2&gt; &lt;h3&gt;mod_php .htaccess example&lt;/h3&gt; &lt;p&gt;add settings to a .htaccess file with ‘php_flag’ like this:&lt;/p&gt; &lt;pre&gt;php_flag register_globals off&lt;br /&gt;php_flag magic_quotes_gpc on&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;strong&gt;In .htaccess, only true/false on/off flags can be set using php_flag. To set other values you need to use php_value, like this:&lt;/strong&gt;&lt;/p&gt; &lt;pre&gt;php_value upload_max_filesize 20M&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;strong&gt;PHP_INI_SYSTEM can be configured per-directory by placing it inside a per-directory block in httpd.conf&lt;/strong&gt;&lt;/p&gt; &lt;pre&gt;# Selectively enable APC for wildly popular directories&lt;br /&gt;# apc.enabled is Off in php.ini to reduce memory use&lt;br /&gt;&lt;directory&gt;&lt;br /&gt;php_flag apc.enabled On&lt;br /&gt;&lt;/directory&gt;&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; In order for these settings to work in your htaccess file, you will need to add “Options” to your AllowOverride specifications for the directory/webserver if it’s not already allowed.&lt;/p&gt; &lt;p&gt;Src: &lt;a href="http://php.net/manual/en/configuration.changes.php"&gt;How to change configuration settings&lt;/a&gt;&lt;/p&gt; &lt;pre&gt;&lt;ifmodule&gt;&lt;br /&gt;php_value include_path ".:/home/askapache/lib/php"&lt;br /&gt;php_admin_flag safe_mode on&lt;br /&gt;&lt;/ifmodule&gt;&lt;br /&gt;&lt;ifmodule&gt;&lt;br /&gt;php_value include_path ".:/home/askapache/lib/php"&lt;br /&gt;php_admin_flag safe_mode on&lt;br /&gt;&lt;/ifmodule&gt;&lt;br /&gt;&lt;ifmodule&gt;&lt;br /&gt;php3_include_path ".:/home/askapache/lib/php"&lt;br /&gt;php3_safe_mode on&lt;br /&gt;&lt;/ifmodule&gt;&lt;br /&gt;&lt;/pre&gt; &lt;h2&gt;Modify PHP configuration via Windows Registry&lt;/h2&gt; &lt;p&gt;When running PHP on Windows, the configuration values can be modified on a per-directory basis using the Windows registry. The configuration values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory Values, in the sub-keys corresponding to the path names. For example, configuration values for the directory c:\inetpub\wwwroot would be stored in the key HKLM\SOFTWARE\PHP\Per Directory Values\c\inetpub\wwwroot. The settings for the directory would be active for any script running from this directory or any subdirectory of it. The values under the key should have the name of the PHP configuration directive and the string value. PHP constants in the values are&lt;br /&gt;not parsed. However, only configuration values changeable in PHP_INI_USER can be set this way, PHP_INI_PERDIR values can not.&lt;/p&gt; &lt;h2&gt;Methods to modify PHP configuration&lt;/h2&gt; &lt;p&gt;Regardless of how you run PHP, you can change certain values at runtime of your scripts through &lt;a href="http://php.net/manual/en/function.ini-set.php"&gt;ini_set()&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;If you are interested in a complete list of configuration settings on your system with their current values, you can execute the &lt;a href="http://php.net/manual/en/function.phpinfo.php"&gt;phpinfo()&lt;/a&gt; function, and review the resulting page. You can also access the values of individual configuration directives at runtime using &lt;a href="http://php.net/manual/en/function.ini-get.php"&gt;ini_get()&lt;/a&gt; or &lt;a href="http://php.net/manual/en/function.get-cfg-var.php"&gt;get_cfg_var()&lt;/a&gt;.&lt;/p&gt; &lt;h2&gt;No input file specified&lt;/h2&gt; &lt;p&gt;One of the most common reasons why you get&lt;/p&gt; &lt;blockquote&gt;&lt;pre&gt;No input file specified&lt;/pre&gt; &lt;/blockquote&gt; &lt;p&gt;(AKA ‘the second most useful error message in the world’) is that you have set &lt;code&gt;doc_root&lt;/code&gt; (in php.ini) to a value which is to the &lt;code&gt;DocumentRoot&lt;/code&gt; defined in the apache configuration.&lt;/p&gt; &lt;p&gt;This is the same for other webservers. For example, on lighttpd, make sure the &lt;code&gt;server.document-root&lt;/code&gt; value is the same as what is defined as &lt;code&gt;doc_root&lt;/code&gt; in php.ini.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;By&lt;/p&gt;&lt;p&gt;Sylesh H&lt;/p&gt;&lt;p&gt;syleshh@gmail.com&lt;/p&gt;&lt;p&gt;9847589760&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-1482924588416437345?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/1482924588416437345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=1482924588416437345' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1482924588416437345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1482924588416437345'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/05/custom-phpini-and-htaccess-rules.html' title='Custom PHP.ini and .htaccess rules'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7285608041854478897</id><published>2009-04-23T04:09:00.000-07:00</published><updated>2009-04-23T04:10:00.937-07:00</updated><title type='text'>Threads vs. Processes</title><content type='html'>&lt;h1 align="center"&gt;Threads vs. Processes&lt;/h1&gt;   &lt;blockquote cite="http://www.devx.com/Intel/Article/29815"&gt; &lt;p&gt; Both threads and processes are methods of parallelizing an application. However, processes are independent execution units that contain their own state information, use their own address spaces, and only interact with each other via interprocess communication mechanisms (generally managed by the operating system). Applications are typically divided into processes during the design phase, and a master process explicitly spawns sub-processes when it makes sense to logically separate significant application functionality. Processes, in other words, are an architectural construct. &lt;/p&gt;  &lt;p&gt;By contrast, a thread is a coding construct that doesn't affect the architecture of an application. A single process might contains multiple threads; all threads within a process share the same state and same memory space, and can communicate with each other directly, because they share the same variables. &lt;/p&gt;  &lt;p&gt;Threads typically are spawned for a short-term benefit that is usually visualized as a serial task, but which doesn't have to be performed in a linear manner (such as performing a complex mathematical computation using parallelism, or initializing a large matrix), and then are absorbed when no longer required. The scope of a thread is within a specific code module—which is why we can bolt-on threading without affecting the broader application. &lt;/p&gt; &lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7285608041854478897?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7285608041854478897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7285608041854478897' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7285608041854478897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7285608041854478897'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/04/threads-vs-processes.html' title='Threads vs. Processes'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-4041135857871032853</id><published>2009-04-21T22:04:00.000-07:00</published><updated>2009-04-23T03:58:58.945-07:00</updated><title type='text'>Showing unlimted quota in WHM(VPS)!! or /scripts/fixauotas results 'No filesystems with quota detected '</title><content type='html'>This is neither a cPanel nor a Virtuozzo issue.&lt;br /&gt;&lt;br /&gt;You should check whether your user/group quotas are enabled or not :&lt;br /&gt;&lt;br /&gt;e.g.&lt;br /&gt;&lt;br /&gt;vzquota stat 101 -t&lt;br /&gt;&lt;br /&gt;     resource          usage       softlimit      hardlimit    grace&lt;br /&gt;     1k-blocks       14929508        51200000       51200000&lt;br /&gt;     inodes         222034          400000         440000&lt;br /&gt;&lt;br /&gt;User/group &lt;span class="highlight"&gt;quota&lt;/span&gt;: &lt;span style="color:Red;"&gt;off,inactive&lt;/span&gt;&lt;br /&gt;Ugids: loaded 0, total 0, limit 0&lt;br /&gt;Ugid limit was exceeded: no&lt;br /&gt;&lt;br /&gt;Enable quotas over Virtuozzo. If there are hardware or other&lt;br /&gt;problems who prevent this setting do it manually:&lt;br /&gt;&lt;br /&gt;vi /etc/sysconfig/vz-scripts/101.conf&lt;br /&gt;&lt;br /&gt;change QUOTAUGIDLIMIT="0"  to  QUOTAUGIDLIMIT="3000" (QUOTAUGIDLIMIT &gt; This is used for tracking quote for all your files in the system)&lt;br /&gt;&lt;br /&gt;restart &lt;span class="highlight"&gt;VPS&lt;/span&gt;. Done.&lt;br /&gt;&lt;br /&gt;Login to the &lt;span class="highlight"&gt;VPS&lt;/span&gt; (VEID) and run /scripts/fixquotas&lt;br /&gt;&lt;br /&gt;Problem should be solved.&lt;br /&gt;&lt;br /&gt;Sylesh&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-4041135857871032853?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/4041135857871032853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=4041135857871032853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4041135857871032853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4041135857871032853'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/04/showing-unlimted-quota-in-whmvps-or.html' title='Showing unlimted quota in WHM(VPS)!! or /scripts/fixauotas results &apos;No filesystems with quota detected &apos;'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3249078093084414024</id><published>2009-04-15T20:41:00.001-07:00</published><updated>2009-04-15T20:41:37.389-07:00</updated><title type='text'>ffmpeg in CentOS is with yum</title><content type='html'>The most easy way to install ffmpeg in CentOS is with yum.&lt;br /&gt;First of all, edit /etc/yum.repos.d/CentOS-Base.repo and add those lines at bottm of file:&lt;br /&gt;[dag]&lt;br /&gt;name=Dag RPM Repository for Centos&lt;br /&gt;baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag&lt;br /&gt;enabled=1&lt;br /&gt;&lt;br /&gt;Then, run command:&lt;br /&gt;yum install ffmpeg&lt;br /&gt;&lt;br /&gt;Or, you can install from svn:&lt;br /&gt;&lt;br /&gt;svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg&lt;br /&gt;&lt;br /&gt;cd ffmpeg&lt;br /&gt;./configure --help&lt;br /&gt;&lt;br /&gt;add some parameters, like --enable-gpl, --enable-libmp3lame, etc..&lt;br /&gt;&lt;br /&gt;make &amp;amp;&amp;amp; make install&lt;br /&gt;&lt;br /&gt;(if svn command not found, type yum install subversion)&lt;br /&gt;&lt;br /&gt;Hope this help&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3249078093084414024?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3249078093084414024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3249078093084414024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3249078093084414024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3249078093084414024'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/04/ffmpeg-in-centos-is-with-yum.html' title='ffmpeg in CentOS is with yum'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-5473507786451715099</id><published>2009-04-08T15:57:00.000-07:00</published><updated>2009-04-08T16:29:07.764-07:00</updated><title type='text'>traceroute</title><content type='html'>When you execute a trace route command (ie traceroute yahoo.com), your machine sends out 3 UDP packets with a TTL (Time-to-Live) of 1. When those packets reach the next hop router, it will decrease the TTL to 0 and thus reject the packet. It will send an ICMP Time-to-Live Exceeded (Type 11), TTL equal 0 during transit (Code 0) back to your machine - with a source address of itself, therefore you now know the address of the first router in the path.&lt;br /&gt;&lt;br /&gt;Next your machine will send 3 UDP packets with a TTL of 2, thus the first router that you already know passes the packets on to the next router after reducing the TTL by 1 to 1. The next router decreases the TTL to 0, thus rejecting the packet and sending the same ICMP Time-to-Live Exceeded with its address as the source back to your machine. Thus you now know the first 2 routers in the path.&lt;br /&gt;&lt;br /&gt;This keeps going until you reach the destination. Since you are sending UDP packets with the destination address of the host you are concerned with, once it gets to the destination the UDP packet is wanting to connect to the port that you have sent as the destination port, since it is an uncommon port, it will most like be rejected with an ICMP Destination Unreachable (Type 3), Port Unreachable (Code 3). This ICMP message is sent back to your machine, which will understand this as being the last hop, therefore trace route will exit, giving you the hops between you and the destination.&lt;br /&gt;&lt;br /&gt;The UDP packet is sent on a high port, destined to another high port. On a Linux box, these ports were not the same, although usually in the 33000. The source port stayed the same throughout the session, however the destination port was increase by one for each packet sent out.&lt;br /&gt;&lt;br /&gt;One note, traceroute actually sends 1 UDP packet of TTL, waits for the return ICMP message, sends the second UDP packet, waits, sends the third, waits, etc, etc, etc.&lt;br /&gt;&lt;br /&gt;If during the session, you receive * * *, this could mean that that router in the path does not return ICMP messages, it returns messages with a TTL too small to reach your machine or a router with buggy software. After a * * * within the path, trace route will still increment the TTL by 1, thus still continuing on in the path determination.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-5473507786451715099?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/5473507786451715099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=5473507786451715099' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5473507786451715099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5473507786451715099'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/04/traceroute.html' title='traceroute'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-4642511602702523810</id><published>2009-04-01T14:26:00.000-07:00</published><updated>2009-04-01T14:29:07.131-07:00</updated><title type='text'>The DNS Database Files</title><content type='html'>&lt;h2&gt;&lt;a name="SECTION008220000"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/h2&gt; Master files included by named, like named.hosts, always have a domain associated with them, which is called the &lt;em&gt;origin&lt;/em&gt;. This is the domain name specified with the cache and primary commands. Within a master file, you are allowed to specify domain and host names relative to this domain.  A name given in a configuration file is considered &lt;em&gt;absolute&lt;/em&gt; if it ends in a single dot, otherwise it is considered relative to the origin.  The origin all by itself may be referred to using ``@''. &lt;p&gt; All data contained in a master file is split up in &lt;em&gt;resource records&lt;/em&gt;, or RRs for short. They make up the smallest unit of information available through DNS. Each resource record has a type. A records, for instance, map a hostname to an IP-address, and a CNAME record associates an alias for a host with its official hostname.  &lt;/p&gt;&lt;p&gt; Resource record representations in master files share a common format, which is &lt;/p&gt;&lt;pre&gt;           [domain] [ttl] [class] type rdata&lt;br /&gt;&lt;/pre&gt; Fields are separated by spaces or tabs. An entry may be continued across several lines if an opening brace occurs before the first newline, and the last field is followed by a closing brace. Anything between a semicolon and a newline is ignored. &lt;dl&gt;&lt;dt&gt;domain &lt;/dt&gt;&lt;dd&gt;This  is  the  domain  name  to which the entry applies. If no                 domain name is given, the RR is assumed to apply to the domain                 of the previous RR.            &lt;/dd&gt;&lt;dt&gt;   ttl &lt;/dt&gt;&lt;dd&gt;  In  order  to force resolvers to discard information after a                 certain time, each RR is associated a ``time to live'', or ttl                 for  short.  The  ttl  field specifies the time in seconds the                 information is valid after it  has  been  retrieved  from  the                 server. It is a decimal number with at most eight digits.                        If no ttl value is given, it defaults to the value of the                 minimum field of the preceding SOA record.             &lt;/dd&gt;&lt;dt&gt;class &lt;/dt&gt;&lt;dd&gt;This is an address class, like IN for IP addresses, or HS  for                 objects  in  the Hesiod class. For TCP/IP networking, you have                 to make this IN.                        If no class field is given, the class of the preceding RR                 is assumed.             &lt;/dd&gt;&lt;dt&gt; type&lt;/dt&gt;&lt;dd&gt; This  describes  the type of the RR. The most common types are                 A, SOA, PTR, and NS.  The following sections describe the var-                 ious types of RR's.             &lt;/dd&gt;&lt;dt&gt;rdata &lt;/dt&gt;&lt;dd&gt; This holds the data associated with the RR. The format of this                 field depends on the  type  of  the  RR.  Below,  it  will  be                 described for each RR separately. &lt;/dd&gt;&lt;/dl&gt; &lt;p&gt; The following is an incomplete list of RRs to be used in DNS master files. There are a couple more of them, which we will not explain. They are experimental, and of little use generally. &lt;/p&gt;&lt;dl&gt;            SOA&lt;dd&gt;This  describes a zone of authority (SOA means ``Start of                 Authority''). It signals that the records following the SOA RR                 contain authoritative information for the domain. Every master                 file included by a  primary  statement  must  contain  an  SOA                 record for this zone. The resource data contains the following                 fields:      &lt;/dd&gt;&lt;dt&gt;origin &lt;/dt&gt;&lt;dd&gt;This is the canonical hostname of the  primary  name                           server  for  this  domain. It is usually given as an                           absolute name.   &lt;/dd&gt;&lt;dt&gt;contact &lt;/dt&gt;&lt;dd&gt;This is the email address of the person  responsible                           for  maintaining  the domain, with the `@' character                           replaced by a dot. For instance, if the  responsible                           person  at  the  Virtual Brewery is janet, then this                           field would contain janet.vbrew.com.   &lt;/dd&gt;&lt;dt&gt; serial &lt;/dt&gt;&lt;dd&gt;This  is  the  version  number  of  the  zone  file,                           expressed  as a single decimal number. Whenever data                           is changed in the zone file, this number  should  be                           incremented.                                  The  serial  number  is  used by secondary name                           servers  to  recognize  when  zone  information  has                           changed.  To  stay  up  to  date,  secondary servers                           request the primary server's SOA record  at  certain                           intervals,  and compare the serial number to that of                           the cached SOA record.  If the number  has  changed,                           the  secondary  servers  transfers  the  whole  zone                           database from the primary server.   &lt;/dd&gt;&lt;dt&gt;refresh&lt;/dt&gt;&lt;dd&gt; This specifies the interval in seconds that the sec-                           ondary  servers should wait between checking the SOA                           record of the primary server. Again, this is a deci-                           mal number with at most eight digits.                                  Generally,  the network topology doesn't change                           too often, so that this  number  should  specify  an                           interval  of  roughly a day for larger networks, and                           even more for smaller ones. &lt;/dd&gt;&lt;dt&gt;retry&lt;/dt&gt;&lt;dd&gt; This number determines the intervals at which a sec-                           ondary  server  should  retry contacting the primary                           server if a request or a zone refresh fails. It must                           not  be  too low, or else a temporary failure of the                           server or a network problem may cause the  secondary                           server  to  waste  network  resources.  One hour, or                           perhaps one half hour, might be a good choice.    &lt;/dd&gt;&lt;dt&gt;expire&lt;/dt&gt;&lt;dd&gt; This specifies the time in seconds after  which  the                           server  should  finally  discard all zone data if it                           hasn't been able to contact the primary  server.  It                           should  normally be very large.  Craig Hunt ([ GETST                           "hunt-tcpip" ]) recommends 42 days.    &lt;/dd&gt;&lt;dt&gt;minimum&lt;/dt&gt;&lt;dd&gt; This is the default ttl value for  resource  records                           that  do  not  explicitly specify one. This requires                           other name servers to discard the RR after a certain                           amount  of  time.  It has however nothing to do with                           the time after which a  secondary  server  tries  to                           update the zone information.                                  minimum should be a large value, especially for                           LANs  where  the  network  topology   almost   never                           changes.   A  value  of  around a week or a month is                           probably a good choice. In the case that single  RRs                           may  change  more  frequently,  you can still assign                           them different ttl's.  &lt;/dd&gt;&lt;dt&gt;A&lt;/dt&gt;&lt;dd&gt;     This associates  an  IP  address  with  a  hostname.  The                 resource  data field contains the address in dotted quad nota-                 tion.                         For each host, there must be  only  one  A  record.  The                 hostname  used  in this A record is considered the official or                 canonical hostname.  All other hostnames are aliases and  must                 be mapped onto the canonical hostname using a CNAME record.   &lt;/dd&gt;&lt;dt&gt; NS&lt;/dt&gt;&lt;dd&gt;     This  points  to  a  master  name server of a subordinate                 zone. For an explanation why one has to have NS  records,  see                 section 3.6.  The resource data field contains the hostname of                 the name server. To resolve  the  hostname,  an  additional  A                 record  is  needed,  the so-called glue record which gives the                 name server's IP address.   &lt;/dd&gt;&lt;dt&gt;CNAME&lt;/dt&gt;&lt;dd&gt;   This associates an alias for a host  with  its  canonical                 hostname.   The  canonical hostname is the one the master file                 provides an A record for; aliases are simply  linked  to  that                 name  by  a  CNAME record, but don't have any other records of                 their own.   &lt;/dd&gt;&lt;dt&gt;PTR&lt;/dt&gt;&lt;dd&gt;     This type of record is used to associate names in the in-                 addr.arpa domain with hostnames. This is used for reverse map-                 ping of IP addresses to hostnames. The hostname given must  be                 the canonical hostname.    &lt;/dd&gt;&lt;dt&gt;MX&lt;/dt&gt;&lt;dd&gt;   This RR announces a mail exchanger for a domain. The rea-                 sons to have mail exchangers are discussed in  section  14.4.1                 in chapter 14..  The syntax of an MX record is  &lt;pre&gt;                     [domain] [ttl] [class] MX preference host&lt;br /&gt;&lt;/pre&gt;                         host names the mail  exchanger  for  domain.  Every  mail                 exchanger  has  an  integer  preference associated with it.  A                 mail transport agent who desires to  deliver  mail  to  domain                 will try all hosts who have an MX record for this domain until                 it succeeds. The one with the lowest preference value is tried                 first,  then  the  others  in  order  of increasing preference                 value.    &lt;/dd&gt;&lt;dt&gt;HINFO&lt;/dt&gt;&lt;dd&gt; This record provides information on the system's hardware  and                 software. Its syntax is  &lt;pre&gt;                     [domain] [ttl] [class] HINFO hardware software&lt;br /&gt;&lt;/pre&gt;                         The hardware field identifies the hardware used  by  this                 host.   There  are special conventions to specify this. A list                 of valid names is  given  in  the  ``Assigned  Numbers''  (RFC                 1340).  If  the field contains any blanks, it must be enclosed                 in double quotes.  The software field names the operating sys-                 tem  software used by the system. Again, a valid name from the                 ``Assigned Numbers'' RFC should be chosen.  &lt;/dd&gt;&lt;/dl&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-4642511602702523810?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/4642511602702523810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=4642511602702523810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4642511602702523810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4642511602702523810'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/04/dns-database-files.html' title='The DNS Database Files'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3549155892440096024</id><published>2009-04-01T12:31:00.000-07:00</published><updated>2009-04-01T12:34:21.408-07:00</updated><title type='text'>Explaining DNS Database Files</title><content type='html'>&lt;div class="section" lang="en"&gt;&lt;div class="titlepage"&gt;&lt;div&gt;&lt;div&gt;&lt;table width="100%" border="0" cellpadding="0" cellspacing="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="left"&gt;&lt;h3 class="bold"&gt;&lt;span class="levelc"&gt;Explaining DNS Database Files&lt;/span&gt;&lt;/h3&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="decoration"&gt;&lt;td class="theme"&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="4" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;This is a typical DNS zone.domain file for the domain &lt;tt class="computeroutput"&gt;maxx.net&lt;/tt&gt;. (Its name would be zone.maxx.net. It will translate from a host name to its IP address.)&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;;&lt;br /&gt;; Addresses for the local domain&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;maxx.net.    IN      SOA   nova.maxx.net. tyager.nova.maxx.net. (&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;                          9602171        ; Serial&lt;br /&gt;                         36000          ; Refresh every 10 hours&lt;br /&gt;                         3600           ; Retry after 1 hour&lt;br /&gt;                         360000         ; Expire after 100 hours&lt;br /&gt;                         36000          ; Minimum TTL is 10 hours )&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;;   Define name servers&lt;br /&gt;;&lt;br /&gt;maxx.net.    IN      NS     nova.maxx.net.&lt;br /&gt;maxx.net.    IN      A      204.251.17.241&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;;   Define localhost&lt;br /&gt;;&lt;br /&gt;localhost    IN      A      127.0.0.1&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;;   Set up hosts&lt;br /&gt;;&lt;br /&gt;maxx        IN      A       204.251.17.241&lt;br /&gt;           IN      MX   5  nova.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;maxx.net.     IN    MX   5  nova.maxx.net.&lt;br /&gt;;&lt;br /&gt;;   All mail for net delivered to nova&lt;br /&gt;;&lt;br /&gt;;*          IN     MX   10  nova.maxx.net.&lt;br /&gt;www         IN     CNAME    nova.maxx.net.&lt;br /&gt;ftp         IN     CNAME    nova.maxx.net.&lt;br /&gt;news        IN     CNAME    nova.maxx.net.&lt;br /&gt;mail        IN     CNAME    nova.maxx.net.&lt;br /&gt;ns          IN     CNAME    nova.maxx.net.&lt;br /&gt;loghost     IN     CNAME    nova.maxx.net.&lt;br /&gt;lucy        IN     A        204.251.17.242&lt;br /&gt;linux       IN     CNAME    lucy.maxx.net.&lt;br /&gt;lucy        IN     MX   10  lucy.maxx.net.&lt;br /&gt;messdos      IN     A        204.251.17.243&lt;br /&gt;messdos      IN     MX   10  messdos.maxx.net.&lt;br /&gt;pentium      IN     CNAME    messdos.maxx.net.&lt;br /&gt;solaris      IN     A        204.251.17.244&lt;br /&gt;solaris      IN     MX   10  solaris.maxx.net.&lt;br /&gt;maxx4        IN     CNAME    solaris.maxx.net.&lt;br /&gt;maxx5        IN     A        204.251.17.245&lt;br /&gt;maxx5        IN     MX   10  maxx5.maxx.net.&lt;br /&gt;maxx6        IN     A        204.251.17.246&lt;br /&gt;maxx6        IN     MX   10  maxx6.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;Most database file entries are known as DNS resource records. Generally, the resource records are shown in order: SOA, NS, followed by the other types, but this ordering isn't required. The data in each entry may be entered in upper, lower, or mixed case. All entries in the database file must start at the beginning of the line. Blank lines as well as any text following a semicolon is ignored.&lt;/p&gt;&lt;p&gt;&lt;tt class="computeroutput"&gt;SOA&lt;/tt&gt; stands for Start of Authority. This acronym notifies &lt;tt class="computeroutput"&gt;named&lt;/tt&gt; that operational parameters follow. The most important one is the Serial field. Every time you make a change to a database file, you must increment its serial number. Only by doing this will secondary servers know they need to reach into your system and pull out new name server data, a procedure known as a "zone transfer." Many DNS administrators use a date-time stamp for this field, like &lt;tt class="computeroutput"&gt;9602171&lt;/tt&gt; for the first version on February 17, 1996.&lt;a class="indexterm" name="d0e9956"&gt;&lt;/a&gt;&lt;a class="indexterm" name="d0e9959"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;First, focus on the SOA section:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;maxx.net. IN SOA nova.maxx.net. tyager.maxx.maxx.net. &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;The "&lt;tt class="computeroutput"&gt;maxx.net.&lt;/tt&gt;" field tells &lt;tt class="computeroutput"&gt;named&lt;/tt&gt; the domain defined by this file. The name server will automatically append it to any host name that appears in the file. The trailing dot is not a type; it keeps &lt;tt class="computeroutput"&gt;named&lt;/tt&gt; from trying to tack on your domain name. Without it, the resolver would be confused by named's expansion of my domain name to "&lt;tt class="computeroutput"&gt;maxx.net.maxx.net&lt;/tt&gt;."&lt;/p&gt;&lt;p&gt;The &lt;tt class="computeroutput"&gt;IN&lt;/tt&gt; stands for the "Internet" class of data. Even though other classes exist, they aren't in common usage. The "&lt;tt class="computeroutput"&gt;nova.maxx.net&lt;/tt&gt;" field is the host on which these database files reside. Finally, "&lt;tt class="computeroutput"&gt;tyager.nova.maxx.net&lt;/tt&gt;" represents the e-mail address of the DNS administrator, where the first dot (between &lt;tt class="computeroutput"&gt;tyager&lt;/tt&gt; and &lt;tt class="computeroutput"&gt;nova&lt;/tt&gt;) would be replaced by the @ symbol to create a valid address. (The @ symbol can't be used here because it has a reserved meaning in DNS database files.)The open parenthesis at the end of the line allows you to split the SOA record across physical lines for readability:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;           9602171          ; Serial&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;           36000            ; Refresh every 10 hours&lt;br /&gt;          3600             ; Retry after 1 hour&lt;br /&gt;          360000           ; Expire after 100 hours&lt;br /&gt;          36000            ; Minimum TTL is 10 hours )&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;The "serial" field was discussed earlier.&lt;/p&gt;&lt;p&gt;The remaining four fields specify various time intervals (all values in seconds) used by the secondary name server:&lt;/p&gt;&lt;div class="variablelist"&gt;&lt;dl&gt;&lt;dt&gt;&lt;span class="term"&gt;&lt;tt class="computeroutput"&gt;Refresh&lt;/tt&gt;&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="list-initial"&gt;The time interval that must elapse between each poll of the primary by the secondary name server (here 36,000 seconds or 10 hours). If the "serial number" has been updated on the primary, the secondary assumes its data is stale and requests updated information as a "zone transfer."&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;span class="term"&gt;&lt;tt class="computeroutput"&gt;Retry&lt;/tt&gt;&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="list-initial"&gt;The time interval used between successive connection attempts by the secondary to reach the primary name server in case the first attempt failed (here 3,600 seconds or one hour). Generally, less than the "refresh" time.&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;span class="term"&gt;&lt;tt class="computeroutput"&gt;Expire&lt;/tt&gt;&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="list-initial"&gt;The time interval after which the secondary expires its data if it can't reach the primary name server (here 360,000 seconds or 100 hours). The secondary will refuse to service requests after this interval.&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;span class="term"&gt;&lt;tt class="computeroutput"&gt;Minimum&lt;/tt&gt;&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="list-initial"&gt;The minimum time-to-live value, which specifies how long other servers should cache data from the name server (here 36,000 seconds or 10 hours).&lt;/p&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;p&gt;There are several types of resource records, identified by the key word in field three of each record. You may present records in any order, but try to organize them for clarity. The &lt;tt class="computeroutput"&gt;NS&lt;/tt&gt; (name server) record tells the hosts that query your server where the name servers for this domain can be found:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;maxx.net.     IN     NS     nova.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;You must include in this list at least one name server, that is the name of the server specified in the SOA record. You can list multiple name servers for your domain. In fact, your domain should have at least two name servers. Your Internet service provider will probably allow you to use their name server as a secondary for your domain, but it must have the trailing dots!&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;maxx.net     IN     A     204.251.17.241&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;The first &lt;tt class="computeroutput"&gt;A&lt;/tt&gt; record, which resolves a fully-qualified host name to an IP address, is a special one. It defines an IP address for unqualified queries, that is, queries for the host &lt;tt class="computeroutput"&gt;maxx.net&lt;/tt&gt;.&lt;/p&gt;&lt;p&gt;Other A records like this one:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;lucy         IN     A      204.251.17.242&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;provide &lt;tt class="computeroutput"&gt;name-to-address&lt;/tt&gt; mapping for a specific named host. The domain defined in this file (&lt;tt class="computeroutput"&gt;maxx.net&lt;/tt&gt;) is appended to the host name you show in the first field.&lt;/p&gt;&lt;p&gt;The &lt;tt class="computeroutput"&gt;CNAME&lt;/tt&gt; records create aliases for existing hosts. These examples illustrate a few common uses:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;www     IN     CNAME     maxx.maxx.net.&lt;br /&gt;ftp IN CNAME maxx.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;You can give a host any alias you like, and as many aliases as you want. The host needn't answer to that name, that is, the alias doesn't need to be the host's true name as reported by hostname or uname.&lt;/p&gt;&lt;p&gt;The other vital type of record is &lt;tt class="computeroutput"&gt;MX&lt;/tt&gt;. This tells SMTP e-mail software where to send mail for each named host:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;lucy     IN     MX   10  lucy.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;When a remote host's mail delivery program sees an e-mail address in your domain, it will query your name server for its applicable &lt;tt class="computeroutput"&gt;MX&lt;/tt&gt; record or records. Every user on your LAN can receive e-mail, even if not every host is running its own e-mail software. The &lt;tt class="computeroutput"&gt;MX&lt;/tt&gt; record for &lt;tt class="computeroutput"&gt;lucy&lt;/tt&gt;, for instance, could easily redirect e-mail to another host on the LAN.&lt;/p&gt;&lt;p&gt;The number (10 in this case) in the fourth field represents a preference value. If you define multiple &lt;tt class="computeroutput"&gt;MX&lt;/tt&gt; records for a host, delivery is attempted to lower-preference value hosts first. The actual value isn't important, only its relationship to other preference values.&lt;/p&gt;&lt;p&gt;On larger LANs it's a good idea to create backup e-mail servers. Smaller LANs can simply rely on the fact that most SMTP mailers will retry deliveries to the site for three days before returning a message to its sender.&lt;/p&gt;&lt;p&gt;The line, shown commented out here, would arrange to redirect e-mail for all hosts in this domain to a single machine:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;;&lt;br /&gt;; All mail for net delivered to nova&lt;br /&gt;;&lt;br /&gt;;*     IN     MX   10  nova.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;This is a very good idea for LANs that benefit from a central e-mail repository.&lt;/p&gt;&lt;div class="section" lang="en"&gt;&lt;div class="titlepage"&gt;&lt;div&gt;&lt;div&gt;&lt;a name="d0e10119"&gt;&lt;/a&gt;&lt;h4&gt;&lt;span class="leveld"&gt;Address-to-Name Mapping&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Also called reverse mapping, the &lt;tt class="computeroutput"&gt;zone.ADDR&lt;/tt&gt; db file allows resolvers to post queries armed with only the IP address of a host. This reverse mapping is used, for example, by Internet server software that prefers to log host names rather than less informative IP addresses.&lt;/p&gt;&lt;p&gt;Address-to-name mapping data will be provided for a DNS server by PTR entries in its &lt;tt class="computeroutput"&gt;zone.ADDR&lt;/tt&gt; files, one for every network served by this DNS server, and its &lt;tt class="computeroutput"&gt;zone.LOCAL&lt;/tt&gt; file.&lt;/p&gt;&lt;p&gt;Each entry will indicate the IP address in reverse order, then the host name. For example, for host littledog.maxx.net, whose IP address is &lt;tt class="computeroutput"&gt;204.251.17.249&lt;/tt&gt;, in the &lt;tt class="computeroutput"&gt;zone.ADDR&lt;/tt&gt; file it's PTR entry would look like:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;249.17.251.204.     IN     PTR     littledog.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;Why is it backwards? Recall that DNS does its parsing from right to left, from most inclusive to most specific. For IP addresses, it needs to parse in the same direction. But IP addresses, from right to left, go from most specific to most inclusive. So the simple answer is to reverse the IP address in the NDS PTR records. Now DNS can parse in the same direction, and resolve in the same order — from most inclusive to most specific.&lt;/p&gt;&lt;p&gt;A shortcut in PTR records is often used. It looks like this:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;249         IN     PTR     littledog.maxx.net.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;If the dot is left off the IP address in the PTR record, DNS will complete the IP address with the IP address of the domain, specified in the file's SOA record. This is also true for A records in name-to-address mapping db files. If the dot is left off, DNS will automatically try to complete the name with the full domain name in this zone. Paying attention to the terminating dot is important.&lt;/p&gt;&lt;p&gt;For the &lt;tt class="computeroutput"&gt;zone.LOCAL&lt;/tt&gt; file we describe the loopback address just as you would expect it, now that we know we have to reverse it. The PTR entry in the &lt;tt class="computeroutput"&gt;zone.LOCAL&lt;/tt&gt; file would look like:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;     1.0.0.127.     IN     PTR     localhost.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;or, using the shortcut:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;     1             IN     PTR     localhost.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;Only one line from &lt;tt class="computeroutput"&gt;named.conf&lt;/tt&gt; remains to be discussed, the "cache" entry. This is a bit of a misnomer as it doesn't have anything to do with local caching. Instead, it defines the master root domain name servers for the Internet. You can retrieve this list from &lt;tt class="computeroutput"&gt;ftp://nic.ddn.mil/netinfo/root-servers.txt&lt;/tt&gt;. You will need to check this site periodically to ensure you have the latest list.&lt;/p&gt;&lt;p&gt;This file lists the root domain servers in human-readable format. You'll need to reformat it for consumption by &lt;tt class="computeroutput"&gt;named&lt;/tt&gt;. Here's what the cache file looks like:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;;          Servers from the root domain&lt;br /&gt;;          ftp://nic.ddn.mil/netinfo/root-servers.txt&lt;br /&gt;;&lt;br /&gt;.                    99999999     IN     NS   A.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   B.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   C.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   D.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   E.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   F.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   G.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   H.ROOT-SERVERS.NET&lt;br /&gt;.                    99999999     IN     NS   I.ROOT-SERVERS.NET&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;; Root servers by address&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;A.ROOT-SERVERS.NET   99999999     IN   A 198.41.0.4&lt;br /&gt;B.ROOT-SERVERS.NET   99999999     IN   A 128.9.0.107&lt;br /&gt;C.ROOT-SERVERS.NET   99999999     IN   A 192.33.4.12&lt;br /&gt;D.ROOT-SERVERS.NET   99999999     IN   A 128.8.10.90&lt;br /&gt;E.ROOT-SERVERS.NET   99999999     IN   A 192.203.230.10&lt;br /&gt;F.ROOT-SERVERS.NET   99999999     IN   A 192.5.5.241&lt;br /&gt;G.ROOT-SERVERS.NET   99999999     IN   A 192.112.36.4&lt;br /&gt;H.ROOT-SERVERS.NET   99999999     IN   A 128.63.2.53&lt;br /&gt;I.ROOT-SERVERS.NET   99999999     IN   A 192.36.148.17&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;Here, the dot (.) refers to the root domain and the &lt;tt class="computeroutput"&gt;99999999&lt;/tt&gt; means a very long &lt;tt class="computeroutput"&gt;time-to-live&lt;/tt&gt; value. The TTL value is no longer used for caching because the data isn't discarded if it times out, but administrators generally keep it around because it does no harm.&lt;/p&gt;&lt;p&gt;Your site may not have access to the Internet or may have protected its connection via a firewall. Often in this type of DNS configuration, one or more machines will be designated as a root server. In this case, the cache file will contain a list of internal root servers, and not the official Internet master root domain servers.&lt;/p&gt;&lt;/div&gt;&lt;div class="section" lang="en"&gt;&lt;div class="titlepage"&gt;&lt;div&gt;&lt;div&gt;&lt;a name="d0e10234"&gt;&lt;/a&gt;&lt;h4&gt;&lt;span class="leveld"&gt;Testing Your Name Server&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Perform simple checks on your name server's health with &lt;tt class="computeroutput"&gt;nslookup&lt;/tt&gt;. This utility is standard with every TCP/IP-network-aware version of UNIX. There are other similar tools available — see "List of Utilities" later in this section for details.&lt;/p&gt;&lt;p&gt;You can find the source code for &lt;tt class="computeroutput"&gt;dig&lt;/tt&gt; at several anonymous FTP archive sites, including: &lt;tt class="computeroutput"&gt;ftp://ftp.wonderland.org/NetBSD/NetBSD-current/src/usr.sbin/named/dig/&lt;/tt&gt; for the NetBSD release. Use Archie to find other sites.&lt;/p&gt;&lt;p&gt;The &lt;tt class="computeroutput"&gt;nslookup&lt;/tt&gt; utility can be used interactively, much like other programs, such as ftp. That is, if you invoke this program without command line arguments, it displays a prompt and waits for your command:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;&gt;server mpe3000&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="programlisting"&gt;Default Name Server: mpe3000.cup.hp.com Address: 15.13.199.80&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;By default, &lt;tt class="computeroutput"&gt;nslookup&lt;/tt&gt; performs queries based on host names you submit; just enter a host name after the prompt:&lt;a class="indexterm" name="d0e10264"&gt;&lt;/a&gt;&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;&gt; romeo&lt;br /&gt;Server:   mpe3000.cup.hp.com&lt;br /&gt;Address:   15.13.199.80&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;Name:     romeo.cup.hp.com&lt;br /&gt;Address:   15.13.194.242&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;&gt; 15.12.194.242&lt;br /&gt;Server:   mpe3000.cup.hp.com&lt;br /&gt;Address:   15.13.199.80&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;Name:     romeo.cup.hp.com&lt;br /&gt;Address:   15.12.194.242&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;You can check the resource records information about name server:&lt;/p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;&gt; set type=ns&lt;br /&gt;&gt; mpeworld&lt;br /&gt;Name Server:   mpeworld.cup.hp.com&lt;br /&gt;Address:   15.13.199.80&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table width="100%" bgcolor="#e0e0e0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre class="screen"&gt;origin = dns.cup.hp.com&lt;br /&gt;mail addr = dns-admin.dns.cup.hp.com&lt;br /&gt;serial = 96092255&lt;br /&gt;refresh = 10800 (3 hours)&lt;br /&gt;retry = 3600 (1 hour) expire = 604800 (7 days)&lt;br /&gt;minimum ttl = 86400 (1 day)&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.docs.hp.com/img/s.gif" alt="" width="1" height="2" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt; &lt;hr /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3549155892440096024?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3549155892440096024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3549155892440096024' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3549155892440096024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3549155892440096024'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/04/explaining-dns-database-files.html' title='Explaining DNS Database Files'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-2780297538050249024</id><published>2009-03-19T02:03:00.000-07:00</published><updated>2009-03-19T02:04:10.502-07:00</updated><title type='text'>How SSL works??</title><content type='html'>SSL is a sophistication encryption scheme that does not require the client and the server to arrange for a secret key to be exchanged between the client and server BEFORE the transaction is started. SSL uses public/private keys to provide a flexible encryption scheme that can be setup at the time of the secure transaction.&lt;br /&gt;In typical encryption schemes the client and server would be required to use a secret key that has been preconfigured in the client and the server machines. In such a scheme, the client would use the secret key to encrypt the data. The server would use the same secret key to decrypt the data. Same logic applies in the server to client direction. This type of preconfigured secret keys are not suitable for Web based secure services that involve millions of users who have no prior secret key arrangement with the secure server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SSL solves this problem by using asymmetric keys. These keys are defined in pairs of public and private keys. As the name suggests the&lt;br /&gt;public key is freely available to anybody. The private key is known only to the server. The keys have two important properties:&lt;br /&gt;&lt;br /&gt;(1) Data encrypted by the client using the pubic key can be decrypted only by the server's private key. Due to this property of the keys, the client is able to send secure data that can be understood only by the server.&lt;br /&gt;&lt;br /&gt;(2) Data encrypted to by the server's private key can only be decrypted using the public key. This property is useful in a client level authentication of the server. If the server sends a known message (say the name of the server), the client can be sure that it is talking to the authentic server and not an imposter if it is successfully able to decrypt the message using the public key.&lt;br /&gt;&lt;br /&gt;Note that property (1) allows us to use conventional secret keys. A secret key can be sent by the client as data that has been encrypted using the public key. This secret key can be decrypted only by the server. Once the server gets the key, the client and the server are able to communicate using this secret key.&lt;br /&gt;The public/private key based encryption is used only for handshaking and secret key exchange. Once the keys have been exchanged the symmetric secret keys are used. This is done for two reasons:&lt;br /&gt;&lt;br /&gt;(1) Public/private key based encryption techniques are computationally very expensive thus their use should be minimized.&lt;br /&gt;&lt;br /&gt;(2) The secret key mechanism is needed for server to client communication.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-2780297538050249024?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/2780297538050249024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=2780297538050249024' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2780297538050249024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2780297538050249024'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/03/how-ssl-works.html' title='How SSL works??'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-383964819102274146</id><published>2009-03-04T14:10:00.001-08:00</published><updated>2009-03-04T14:16:22.705-08:00</updated><title type='text'>Openvz - vzquota : (error) Quota on syscall for 200: Device or resource busy</title><content type='html'>If you see this error when trying to start up a vps then you will need to kill off some processes.&lt;br /&gt;&lt;br /&gt;Run this on the node to find them. Be sure to replace 200 with the correct veid.&lt;br /&gt;&lt;br /&gt;lsof 2&gt; /dev/null | egrep '/vz/root/200|/vz/private/200'&lt;br /&gt;&lt;br /&gt;Kill -9 the PID's listed from the previous command.&lt;br /&gt;&lt;br /&gt;The vps should now start up fine. &lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Sylesh&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-383964819102274146?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/383964819102274146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=383964819102274146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/383964819102274146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/383964819102274146'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/03/penvz-vzquota-error-quota-on-syscall.html' title='Openvz - vzquota : (error) Quota on syscall for 200: Device or resource busy'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6379780865684110238</id><published>2009-03-04T13:53:00.001-08:00</published><updated>2009-03-04T13:53:38.026-08:00</updated><title type='text'>Sed Example</title><content type='html'>sed -e 's/oldstuff/newstuff/g' inputFileName &gt; outputFileName&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6379780865684110238?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6379780865684110238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6379780865684110238' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6379780865684110238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6379780865684110238'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/03/sed-example.html' title='Sed Example'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3077788497228205672</id><published>2009-03-01T22:00:00.000-08:00</published><updated>2009-03-01T22:24:45.329-08:00</updated><title type='text'>Difference b/w Ping and Traceroute?</title><content type='html'>Ping&lt;br /&gt;----&lt;br /&gt;&lt;br /&gt;Ping is a program that sends a series of packets over a network or the Internet to a specific computer in order to generate a response from that computer. The other computer responds with an acknowledgment that it received the packets. Ping was created to verify whether a specific computer on a network or the Internet exists and is connected.&lt;br /&gt;Ping uses ICMP (Internet Control Message Protocol) packets. The packet from the origin computer is called an "ICMP_echo_request", and the response from the target is called an "ICMP_echo_reply". Each packet contains by default either 32 or 64 bytes of data and 8 bytes of protocol reader information, but ping can be configured at the command line to use different sized packets. You can access a list of switches and additional functions by invoking the help file for ping:&lt;br /&gt;&lt;br /&gt;In an IP network, `ping' sends a short data burst - a single packet - and listens for a single packet in reply. Since this tests the most basic function of an IP network (delivery of single packet), it's easy to see how you can learn a lot from some `pings'.&lt;br /&gt;&lt;br /&gt;Ping is implemented using the required ICMP Echo function, documented in RFC 792 that all hosts should implement. Of course, administrators can disable ping messages (this is rarely a good idea, unless security considerations dictate that the host should be unreachable anyway), and some implementations have (gasp) even been known not to implement all required functions. However, ping is usually a better bet than almost any other network software.&lt;br /&gt;&lt;br /&gt;Many versions of ping are available. For the remainder of this discussion, I assume use of BSD UNIX's ping, a freely available, full-featured ping available for many UNIX systems. Most PC-based pings do not have the advanced features I describe. As always, read the manual for whatever version you use.&lt;br /&gt;&lt;br /&gt;What Ping can tell you&lt;br /&gt;&lt;br /&gt;    * Ping places a unique sequence number on each packet it transmits, and reports which sequence numbers it receives back. Thus, you can determine if packets have been dropped, duplicated, or reordered.&lt;br /&gt;    * Ping checksums each packet it exchanges. You can detect some forms of damaged packets.&lt;br /&gt;    * Ping places a timestamp in each packet, which is echoed back and can easily be used to compute how long each packet exchange took - the Round Trip Time (RTT).&lt;br /&gt;    * Ping reports other ICMP messages that might otherwise get buried in the system software. It reports, for example, if a router is declaring the target host unreachable. &lt;br /&gt;&lt;br /&gt;What Ping can not tell you&lt;br /&gt;&lt;br /&gt;    * Some routers may silently discard undeliverable packets. Others may believe a packet has been transmitted successfully when it has not been. (This is especially common over Ethernet, which does not provide link-layer acknowledgments) Therefore, ping may not always provide reasons why packets go unanswered.&lt;br /&gt;    * Ping can not tell you why a packet was damaged, delayed, or duplicated. It can not tell you where this happened either, although you may be able to deduce it.&lt;br /&gt;    * Ping can not give you a blow-by-blow description of every host that handled the packet and everything that happened at every step of the way. It is an unfortunate fact that no software can reliably provide this information for a TCP/IP network. &lt;br /&gt;**********************************************************************************************&lt;br /&gt;Traceroute&lt;br /&gt;&lt;br /&gt;Traceroute is the program that shows you the route over the network between two systems, listing all the intermediate routers a connection must pass through to get to its destination. It can help you determine why your connections to a given server might be poor, and can often help you figure out where exactly the problem is. It also shows you how systems are connected to each other, letting you see how your ISP connects to the Internet as well as how the target system is connected.&lt;br /&gt;Traceroute utilities work by sending packets with low time-to-live (TTL) fields. The TTL value specifies how many hops the packet is allowed before it is returned. When a packet can't reach its destination because the TTL value is too low, the last host returns the packet and identifies itself. By sending a series of packets and incrementing the TTL value with each successive packet, traceroute finds out who all the intermediary hosts are.&lt;br /&gt;&lt;br /&gt;Sylesh&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3077788497228205672?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3077788497228205672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3077788497228205672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3077788497228205672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3077788497228205672'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/03/difference-bw-ping-and-traceroute.html' title='Difference b/w Ping and Traceroute?'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-4582238571583812858</id><published>2009-02-28T08:27:00.001-08:00</published><updated>2009-02-28T08:27:55.174-08:00</updated><title type='text'>List of Different web servers on GNU Linux</title><content type='html'>List of Different web servers on GNU Linux&lt;br /&gt;&lt;br /&gt;Today we have different web servers available on the GNU/Linux platform.Here i am listing only the web servers that can be used for a mainstream web hosting environment&lt;br /&gt;&lt;br /&gt;The web servers can be classified basically into 2&lt;br /&gt;&lt;br /&gt;1. Process based webserver - In a process based web server each new connection is handled by a new web server process or thread. Following are some of the process based servers available on the GNU /Linux platform.A notable draw back for a process based web server is the famous C10K problem ( http://www.kegel.com/c10k.html ).That said there are many implementations of this model that are high performance in nature&lt;br /&gt;&lt;br /&gt;    * Apache HTTPD - http://httpd.apache.org/  - the most famous web server and the most widely used - supports a very large number of modules and very feature rich&lt;br /&gt;    * Cherokee - http://www.cherokee-project.com/ - is a fast flexible easy to configure web server - A notable feature is the administrative interface available that lessens the burden of tampering with the configuration files&lt;br /&gt;    * LiteSpeed - http://www.litespeedtech.com/ - Apache compatible web server ,but claimed to be of having improved perfomance&lt;br /&gt;&lt;br /&gt;2- Asynchronus web server or non-blocking i/o webserver - Or in laymans words a web server that uses a single process to handle multiple request ,switching over to the next request when the previous one is waiting for an i/o request is to be fullfilled. This architecture is more scalable and theoretically solves the C10K problem.The famous members of this family of servers are&lt;br /&gt;&lt;br /&gt;    * Nginx - http://wiki.codemongers.com/Main  - pronounced EngineX - is  a powerfull light weight web server and has a cleaner configuration -It is also feature rich and widely used&lt;br /&gt;    * Lighttpd  - http://www.lighttpd.net/ -  This is another powerfull and light weight web server and has a very large number of modules and features&lt;br /&gt;&lt;br /&gt;All the above mentioned web servers are widely used in the web hosting industry ,in dedicated ,vps and shared hosting environments&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-4582238571583812858?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/4582238571583812858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=4582238571583812858' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4582238571583812858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4582238571583812858'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/list-of-different-web-servers-on-gnu.html' title='List of Different web servers on GNU Linux'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-1875431279907565699</id><published>2009-02-27T01:49:00.001-08:00</published><updated>2009-02-27T01:49:15.663-08:00</updated><title type='text'>SED Tutorial</title><content type='html'>SED Tutorial&lt;br /&gt;&lt;br /&gt;    * The sed utility is an "editor"&lt;br /&gt;    * It is also noninteractive. This means you have to insert commands to be executed on the data at the command line or in a script to be processed.&lt;br /&gt;    * sed accepts a series of commands and executes them on a file (or set of files).&lt;br /&gt;    * sed fittingly stands for stream editor.&lt;br /&gt;    * It can be used to change all occurrences of "SAD" to "SED" or "New York" to "Newport."&lt;br /&gt;    * The stream editor is ideally suited to performing repetitive edits that would take considerable time if done manually. &lt;br /&gt;&lt;br /&gt;How sed Works&lt;br /&gt;&lt;br /&gt;The sed utility works by sequentially reading a file, line by line, into memory. It then performs all actions specified for the line and places the line back in memory to dump to the terminal with the requested changes made. After all actions have taken place to this one line, it reads the next line of the file and repeats the process until it is finished with the file. As mentioned, the default output is to display the contents of each line on the screen. Two important factors come into play here—first, the output can be redirected to another file to save the changes; second, the original file, by default, is left unchanged. The default is for sed to read the entire file and make changes to each line within it. It can, however, be restricted to specified lines as needed.&lt;br /&gt;&lt;br /&gt;The syntax for the utility is:&lt;br /&gt;&lt;br /&gt;sed [options] '{command}' [filename]&lt;br /&gt;&lt;br /&gt;In this tutorial we will walk through the most commonly used commands and options and illustrate how they work and where they would be appropriate for use.&lt;br /&gt;&lt;br /&gt;The Substitute Command&lt;br /&gt;&lt;br /&gt;One of the most common uses of the sed utility, and any similar editor, is to substitute one value for another. To accomplish this, the syntax for the command portion of the operation is:&lt;br /&gt;&lt;br /&gt;'s/{old value}/{new value}/'&lt;br /&gt;&lt;br /&gt;Thus, the following illustrates how "lion" can be changed to "eagle" very simply:&lt;br /&gt;&lt;br /&gt;$ echo The lion group will meet on Tuesday after school | sed &lt;br /&gt;   's/lion/eagle/'&lt;br /&gt;The eagle group will meet on Tuesday after school&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Notice that it is not necessary to specify a filename if input is being derived from the output of a preceding command—the same as is true for awk, sort, and most other LinuxUNIX command-line utility programs.&lt;br /&gt;&lt;br /&gt;Multiple Changes&lt;br /&gt;&lt;br /&gt;If multiple changes need to be made to the same file or line, there are three methods by which this can be accomplished. The first is to use the "-e" option, which informs the program that more than one editing command is being used. For example:&lt;br /&gt;&lt;br /&gt;$ echo The lion group will meet on Tuesday after school | sed -e '&lt;br /&gt;   s/lion/eagle/' -e 's/after/before/'&lt;br /&gt;The eagle group will meet on Tuesday before school&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;This is pretty much the long way of going about it, and the "-e" option is not commonly used to any great extent. A more preferable way is to separate command with semicolons:&lt;br /&gt;&lt;br /&gt;$ echo The lion group will meet on Tuesday after school | sed '&lt;br /&gt;   s/lion/eagle/; s/after/before/'&lt;br /&gt;The eagle group will meet on Tuesday before school &lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Notice that the semicolon must be the next character following the slash. If a space is between the two, the operation will not successfully complete and an error message will be returned. These two methods are well and good, but there is one more method that many administrators prefer. The key thing to note is that everything between the two apostrophes (' ') is interpreted as sed commands. The shell program reading in the commands will not assume you are finished entering until the second apostrophe is entered. This means that the command can be entered on multiple lines—with Linux changing the prompt from PS1 to a continuation prompt (usually "&gt;")—until the second apostrophe is entered. As soon as it is entered, and Enter pressed, the processing will take place and the same results will be generated, as the following illustrates:&lt;br /&gt;&lt;br /&gt;$ echo The lion group will meet on Tuesday after school | sed '&lt;br /&gt;&gt; s/lion/eagle/&lt;br /&gt;&gt; s/after/before/'&lt;br /&gt;The eagle group will meet on Tuesday before school&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Global Changes&lt;br /&gt;&lt;br /&gt;Let's begin with a deceptively simple edit. Suppose the message that is to be changed contains more than one occurrence of the item to be changed. By default, the result can be different than what was expected, as the following illustrates:&lt;br /&gt;&lt;br /&gt;$ echo The lion group will meet this Tuesday at the same time&lt;br /&gt;    as the meeting last Tuesday | sed 's/Tuesday/Thursday/'&lt;br /&gt;The lion group will meet this Thursday at the same time&lt;br /&gt;    as the meeting last Tuesday &lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Instead of changing every occurrence of "Tuesday" for "Thursday," the sed editor moves on after finding a change and making it, without reading the whole line. The majority of sed commands function like the substitute one, meaning they all work for the first occurrence of the chosen sequence in each line. In order for every occurrence to be substituted, in the event that more than one occurrence appears in the same line, you must specify for the action to take place globally:&lt;br /&gt;&lt;br /&gt;$ echo The lion group will meet this Tuesday at the same time&lt;br /&gt;    as the meeting last Tuesday | sed 's/Tuesday/Thursday/g'&lt;br /&gt;The lion group will meet this Thursday at the same time&lt;br /&gt;    as the meeting last Thursday&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Bear in mind that this need for globalization is true whether the sequence you are looking for consists of only one character or a phrase.&lt;br /&gt;&lt;br /&gt;sed can also be used to change record field delimiters from one to another. For example, the following will change all tabs to spaces:&lt;br /&gt;&lt;br /&gt;sed 's/ / /g' &lt;br /&gt;&lt;br /&gt;where the entry between the first set of slashes is a tab, while the entry between the second set is a space. As a general rule, sed can be used to change any printable character to any other printable character. If you want to change unprintable characters to printable ones—for example, a bell to the word "bell"—sed is not the right tool for the job (but tr would be).&lt;br /&gt;&lt;br /&gt;Sometimes, you don't want to change every occurrence that appears in a file. At times, you only want to make a change if certain conditions are met—for example, following a match of some other data. To illustrate, consider the following text file:&lt;br /&gt;&lt;br /&gt;$ cat sample_one&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Suppose that it would be desirable for "1" to be substituted with "2," but only after the word "two" and not throughout every line. This can be accomplished by specifying that a match is to be found before giving the substitute command:&lt;br /&gt;&lt;br /&gt;$ sed '/two/ s/1/2/' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;And now, to make it even more accurate:&lt;br /&gt;&lt;br /&gt;$ sed '&lt;br /&gt;&gt; /two/ s/1/2/&lt;br /&gt;&gt; /three/ s/1/3/' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Bear in mind once again that the only thing changed is the display. If you look at the original file, it is the same as it always was. You must save the output to another file to create permanence. It is worth repeating that the fact that changes are not made to the original file is a true blessing in disguise—it lets you experiment with the file without causing any real harm, until you get the right commands working exactly the way you expect and want them to.&lt;br /&gt;&lt;br /&gt;The following saves the changed output to a new file:&lt;br /&gt;&lt;br /&gt;$ sed '&lt;br /&gt;&gt; /two/ s/1/2/&lt;br /&gt;&gt; /three/ s/1/3/' sample_one &gt; sample_two&lt;br /&gt;&lt;br /&gt;The output file has all the changes incorporated in it that would normally appear on the screen. It can now be viewed with head, cat, or any other similar utility.&lt;br /&gt;&lt;br /&gt;Script Files&lt;br /&gt;&lt;br /&gt;The sed tool allows you to create a script file containing commands that are processed from the file, rather than at the command line, and is referenced via the "-f" option. By creating a script file, you have the ability to run the same operations over and over again, and to specify far more detailed operations than what you would want to try to tackle from the command line each time.&lt;br /&gt;&lt;br /&gt;Consider the following script file:&lt;br /&gt;&lt;br /&gt;$ cat sedlist&lt;br /&gt;/two/ s/1/2/&lt;br /&gt;/three/ s/1/3/&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;It can now be used on the data file to obtain the same results we saw earlier:&lt;br /&gt;&lt;br /&gt;$ sed -f sedlist sample_one&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Notice that apostrophes are not used inside the source file, or from the command line when the "-f" option is invoked. Script files, also known as source files, are invaluable for operations that you intend to repeat more than once and for complicated commands where there is a possibility that you may make an error at the command line. It is far easier to edit the source file and change one character than to retype a multiple-line entry at the command line.&lt;br /&gt;&lt;br /&gt;Restricting Lines&lt;br /&gt;&lt;br /&gt;The default is for the editor to look at, and for editing to take place on, every line that is input to the stream editor. This can be changed by specifying restrictions preceding the command. For example, to substitute "1" with "2" only in the fifth and sixth lines of the sample file's output, the command would be:&lt;br /&gt;&lt;br /&gt;$ sed '5,6 s/1/2/' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;In this case, since the lines to changes were specifically specified, the substitute command was not needed. Thus you have the flexibility of choosing which lines to changes (essentially, restricting the changes) based upon matching criteria that can be either line numbers or a matched pattern.&lt;br /&gt;&lt;br /&gt;Prohibiting the Display&lt;br /&gt;&lt;br /&gt;The default is for sed to display on the screen (or to a file, if so redirected) every line from the original file, whether it is affected by an edit operation or not; the "-n" parameter overrides this action. "-n" overrides all printing and displays no lines whatsoever, whether they were changed by the edit or not. For example:&lt;br /&gt;&lt;br /&gt;$ sed -n -f sedlist sample_one&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;$ sed -n -f sedlist sample_one &gt; sample_two&lt;br /&gt;$ cat sample_two&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;In the first example, nothing is displayed on the screen. In the second example, nothing is changed, and thus nothing is written to the new file—it ends up being empty. Doesn't this negate the whole purpose of the edit? Why is this useful? It is useful only because the "-n" option has the ability to be overridden by a print command (-p). To illustrate, suppose the script file were modified to now resemble the following:&lt;br /&gt;&lt;br /&gt;$ cat sedlist&lt;br /&gt;/two/ s/1/2/p&lt;br /&gt;/three/ s/1/3/p&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Then this would be the result of running it:&lt;br /&gt;&lt;br /&gt;$ sed -n -f sedlist sample_one&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Lines that stay the same as they were are not displayed at all. Only the lines affected by the edit are displayed. In this manner, it is possible to pull those lines only, make the changes, and place them in a separate file:&lt;br /&gt;&lt;br /&gt;$ sed -n -f sedlist sample_one &gt; sample_two&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;$ cat sample_two&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Another method of utilizing this is to print only a set number of lines. For example, to print only lines two through six while making no other editing changes:&lt;br /&gt;&lt;br /&gt;$ sed -n '2,6p' sample_one&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;All other lines are ignored, and only lines two through six are printed as output. This is something remarkable that you cannot do easily with any other utility. head will print the top of a file, and tail will print the bottom, but sed allows you to pull anything you want to from anywhere.&lt;br /&gt;&lt;br /&gt;Deleting Lines&lt;br /&gt;&lt;br /&gt;Substituting one value for another is far from the only function that can be performed with a stream editor. There are many more possibilities, and the second-most-used function in my opinion is delete. Delete works in the same manner as substitute, only it removes the specified lines (if you want to remove a word and not a line, don't think of deleting, but think of substituting it for nothing—s/cat//).&lt;br /&gt;&lt;br /&gt;The syntax for the command is:&lt;br /&gt;&lt;br /&gt;'{what to find} d'&lt;br /&gt;&lt;br /&gt;To remove all of the lines containing "two" from the sample_one file:&lt;br /&gt;&lt;br /&gt;$ sed '/two/ d' sample_one&lt;br /&gt;one     1&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;To remove the first three lines from the display, regardless of what they are:&lt;br /&gt;&lt;br /&gt;$ sed '1,3 d' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Only the remaining lines are shown, and the first three cease to exist in the display. There are several things to keep in mind with the stream editor as they relate to global expressions in general, and as they apply to deletions in particular:&lt;br /&gt;&lt;br /&gt;# The up carat (^) signifies the beginning of a line, thus&lt;br /&gt;&lt;br /&gt;sed '/^two/ d' sample_one&lt;br /&gt;&lt;br /&gt;would only delete the line if "two" were the first three characters of the line.&lt;br /&gt;# The dollar sign ($) represents the end of the file, or the end of a line, thus&lt;br /&gt;&lt;br /&gt;sed '/two$/ d' sample_one&lt;br /&gt;&lt;br /&gt;would delete the line only if "two" were the last three characters of the line.&lt;br /&gt;&lt;br /&gt;The result of putting these two together:&lt;br /&gt;&lt;br /&gt;sed '/^$/ d' {filename}&lt;br /&gt;&lt;br /&gt;deletes all blank lines from a file. For example, the following substitutes "1" for "2" as well as "1" for "3" and removes any trailing lines in the file:&lt;br /&gt;&lt;br /&gt;$ sed '/two/ s/1/2/; /three/ s/1/3/; /^$/ d' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;A common use for this is to delete a header. The following command will delete all lines in a file, from the first line through to the first blank line:&lt;br /&gt;&lt;br /&gt;sed '1,/^$/ d' {filename}&lt;br /&gt;&lt;br /&gt;Appending and Inserting Text&lt;br /&gt;&lt;br /&gt;Text can be appended to the end of a file by using sed with the "a" option. This is done in the following manner:&lt;br /&gt;&lt;br /&gt;$ sed '$a&lt;br /&gt;&gt; This is where we stop&lt;br /&gt;&gt; the test' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;This is where we stop&lt;br /&gt;the test&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Within the command, the dollar sign ($) signifies that the text is to be appended to the end of the file. The backslashes () are necessary to signify that a carriage return is coming. If they are left out, an error will result proclaiming that the command is garbled; anywhere that a carriage return is to be entered, you must use the backslash.&lt;br /&gt;&lt;br /&gt;To append the lines into the fourth and fifth positions instead of at the end, the command becomes:&lt;br /&gt;&lt;br /&gt;$ sed '3a&lt;br /&gt;&gt; This is where we stop&lt;br /&gt;&gt; the test' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;This is where we stop&lt;br /&gt;the test&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;This appends the text after the third line. As with almost any editor, you can choose to insert rather than append if you so desire. The difference between the two is that append follows the line specified, and insert starts with the line specified. When using insert instead of append, just replace the "a" with an "i," as shown below:&lt;br /&gt;&lt;br /&gt;$ sed '3i&lt;br /&gt;&gt; This is where we stop&lt;br /&gt;&gt; the test' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;This is where we stop&lt;br /&gt;the test&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;The new text appears in the middle of the output, and processing resumes normally after the specified operation is carried out.&lt;br /&gt;&lt;br /&gt;Reading and Writing Files&lt;br /&gt;&lt;br /&gt;The ability to redirect the output has already been illustrated, but it needs to be pointed out that files can be read in and written out to simultaneously during operation of the editing commands. For example, to perform the substitution and write the lines between one and three to a file called sample_three:&lt;br /&gt;&lt;br /&gt;$ sed '&lt;br /&gt;&gt; /two/ s/1/2/&lt;br /&gt;&gt; /three/ s/1/3/&lt;br /&gt;&gt; 1,3 w sample_three' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;$ cat sample_three&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Only the lines specified are written to the new file, thanks to the "1,3" specification given to the w (write) command. Regardless of those written, all lines are displayed in the default output.&lt;br /&gt;&lt;br /&gt;The Change Command&lt;br /&gt;&lt;br /&gt;In addition to substituting entries, it is possible to change the lines from one value to another. The thing to keep in mind is that substitute works on a character-for-character basis, whereas change functions like delete in that it affects the entire line:&lt;br /&gt;&lt;br /&gt;$ sed '/two/ c&lt;br /&gt;&gt; We are no longer using two' sample_one&lt;br /&gt;one     1&lt;br /&gt;We are no longer using two&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;We are no longer using two&lt;br /&gt;We are no longer using two&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;Working much like substitute, the change command is greater in scale—completely replacing the one entry for another, regardless of character content, or context. At the risk of overstating the obvious, when substitute was used, then only the character "1" was replaced with "2," while when using change, the entire original line was modified. In both situations, the match to look for was simply the "two."&lt;br /&gt;&lt;br /&gt;Change All but...&lt;br /&gt;&lt;br /&gt;With most sed commands, the functions are spelled out as to what changes are to take place. Using the exclamation mark, it is possible to have the changes take place everywhere but those specified—completely reversing the default operation.&lt;br /&gt;&lt;br /&gt;For example, to delete all lines that contain the phrase "two," the operation is:&lt;br /&gt;&lt;br /&gt;$ sed '/two/ d' sample_one&lt;br /&gt;one     1&lt;br /&gt;three   1&lt;br /&gt;one     1&lt;br /&gt;three   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;And to delete all lines except those that contain the phrase "two," the syntax becomes:&lt;br /&gt;&lt;br /&gt;$ sed '/two/ !d' sample_one&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;two     1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;If you have a file that contains a list of items and want to perform an operation on each of the items in the file, then it is important that you first do an intelligent scan of those entries and think about what you are doing. To make matters easier, you can do so by combining sed with any iteration routine (for, while, until).&lt;br /&gt;&lt;br /&gt;As an example, assume you have a text file named "animals" with the following entries:&lt;br /&gt;&lt;br /&gt;pig&lt;br /&gt;horse&lt;br /&gt;elephant&lt;br /&gt;cow&lt;br /&gt;dog&lt;br /&gt;cat&lt;br /&gt;&lt;br /&gt;And you want to run the following routine:&lt;br /&gt;&lt;br /&gt;#mcd.ksh&lt;br /&gt;for I in $*&lt;br /&gt;do&lt;br /&gt;echo Old McDonald had a $I&lt;br /&gt;echo E-I, E-I-O&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;The result will be that each line is printed at the end of "Old McDonald has a." While this is correct for the majority of the entries, it is grammatically incorrect for the "elephant" entry, as the result should be "an elephant" rather than "a elephant." Using sed, you can scan the output from your shell file for such grammatical errors and correct them on the fly, by first creating a file of commands:&lt;br /&gt;&lt;br /&gt;#sublist&lt;br /&gt;/ a a/ s/ a / an /&lt;br /&gt;/ a e/ s/ a / an /&lt;br /&gt;/a i/ s / a / an /&lt;br /&gt;/a o/ s/ a / an /&lt;br /&gt;/a u/ s/ a / an /&lt;br /&gt;&lt;br /&gt;and then executing the process as follows:&lt;br /&gt;&lt;br /&gt;$ sh mcd.ksh 'cat animals' | sed -f sublist  &lt;br /&gt;&lt;br /&gt;Now, after the mcd script has been run, sed will scan the output for anywhere that the single letter a (space, "a," space) is followed by a vowel. If such exists, it will change the sequence to space, "an," space. This corrects the problem before it ever prints on the screen and ensures that editors everywhere sleep easier at night. The result is:&lt;br /&gt;&lt;br /&gt;Old McDonald had a pig&lt;br /&gt;E-I, E-I-O&lt;br /&gt;Old McDonald had a horse&lt;br /&gt;E-I, E-I-O&lt;br /&gt;Old McDonald had an elephant&lt;br /&gt;E-I, E-I-O&lt;br /&gt;Old McDonald had a cow&lt;br /&gt;E-I, E-I-O&lt;br /&gt;Old McDonald had a dog&lt;br /&gt;E-I, E-I-O&lt;br /&gt;Old McDonald had a cat&lt;br /&gt;E-I, E-I-O&lt;br /&gt;&lt;br /&gt;Quitting Early&lt;br /&gt;&lt;br /&gt;The default is for sed to read through an entire file and stop only when the end is reached. You can stop processing early, however, by using the quit command. Only one quit command can be specified, and processing will continue until the condition calling the quit command is satisfied.&lt;br /&gt;&lt;br /&gt;For example, to perform substitution only on the first five lines of a file and then quit:&lt;br /&gt;&lt;br /&gt;$ sed '&lt;br /&gt;&gt; /two/ s/1/2/&lt;br /&gt;&gt; /three/ s/1/3/&lt;br /&gt;&gt; 5q' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;The entry preceding the quit command can be a line number, as shown, or a find/matching command like the following:&lt;br /&gt;&lt;br /&gt;$ sed '&lt;br /&gt;&gt; /two/ s/1/2/&lt;br /&gt;&gt; /three/ s/1/3/&lt;br /&gt;&gt; /three/q' sample_one&lt;br /&gt;one     1&lt;br /&gt;two     2&lt;br /&gt;three   3&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;You can also use the quit command to view lines beyond a standard number and add functionality that exceeds those in head. For example, the head command allows you to specify how many of the first lines of a file you want to see—the default number is ten, but any number can be used from one to ninety-nine. If you want to see the first 110 lines of a file, you cannot do so with head, but you can with sed:&lt;br /&gt;&lt;br /&gt;sed 110q filename&lt;br /&gt;&lt;br /&gt;Handling Problems&lt;br /&gt;&lt;br /&gt;The main thing to keep in mind when dealing with sed is how it works. It works by reading one line in, performing all the tasks it knows to perform on that one line, and then moving on to the next line. Each line is subjected to every editing command given.&lt;br /&gt;&lt;br /&gt;This can be troublesome if the order of your operations is not thoroughly thought out. For example, suppose you need to change all "two" entries to "three" and all "three" to "four":&lt;br /&gt;&lt;br /&gt;$ sed '&lt;br /&gt;&gt; /two/ s/two/three/&lt;br /&gt;&gt; /three/ s/three/four/' sample_one&lt;br /&gt;one     1&lt;br /&gt;four     1&lt;br /&gt;four   1&lt;br /&gt;one     1&lt;br /&gt;four     1&lt;br /&gt;four     1&lt;br /&gt;four   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;The very first "two" read was changed to "three." It then meets the criteria established for the next edit and becomes "four." The end result is not what was wanted—there are now no entries but "four" where there should be "three" and "four."&lt;br /&gt;&lt;br /&gt;When performing such an operation, you must pay diligent attention to the manner in which the operations are specified and arrange them in an order in which one will not clobber another. For example:&lt;br /&gt;&lt;br /&gt;$ sed '&lt;br /&gt;&gt; /three/ s/three/four/&lt;br /&gt;&gt; /two/ s/two/three/' sample_one&lt;br /&gt;one     1&lt;br /&gt;three     1&lt;br /&gt;four   1&lt;br /&gt;one     1&lt;br /&gt;three     1&lt;br /&gt;three     1&lt;br /&gt;four   1&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;This works perfectly, since the "three" value is changed prior to "two" becoming "three."&lt;br /&gt;&lt;br /&gt;Labels and Comments&lt;br /&gt;&lt;br /&gt;Labels can be placed inside sed script files to make it easier to explain what is transpiring, once the files begin to grow in size. There are a variety of commands that relate to these labels, and they include:&lt;br /&gt;&lt;br /&gt;# : The colon signifies a label name. For example:&lt;br /&gt;&lt;br /&gt;         :HERE&lt;br /&gt;&lt;br /&gt;Labels beginning with the colon can be addressed by "b" and "t" commands.&lt;br /&gt;&lt;br /&gt;# b {label} Works as a "goto" statement, sending processing to the label preceded by a colon. For example,&lt;br /&gt;&lt;br /&gt;    b HERE&lt;br /&gt;&lt;br /&gt;sends processing to the line&lt;br /&gt;&lt;br /&gt;    :HERE&lt;br /&gt;&lt;br /&gt;If no label is specified following the b, processing goes to the end of the script file.&lt;br /&gt;&lt;br /&gt;# t {label} Branches to the label only if substitutions have been made since the last input line or execution of a "t" command. As with "b," if a label name is not given, processing moves to the end of the script file.&lt;br /&gt;&lt;br /&gt;# # The pound sign as the first character of a line causes the entire line to be treated as a comment. Comment lines are different from labels and cannot be branched to with b or t commands.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-1875431279907565699?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/1875431279907565699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=1875431279907565699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1875431279907565699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1875431279907565699'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/sed-tutorial.html' title='SED Tutorial'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7374815349181726635</id><published>2009-02-27T01:47:00.001-08:00</published><updated>2009-02-27T01:47:24.291-08:00</updated><title type='text'>Network File System(NFS)</title><content type='html'>Network File System&lt;br /&gt;Among the many different file systems that Linux supports is the Network File System, also known as NFS. NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.&lt;br /&gt;&lt;br /&gt;    * There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The server has to be running the following daemons:&lt;br /&gt;&lt;br /&gt;    * nfsd The NFS daemon which services requests from the NFS clients.&lt;br /&gt;    * mountd The NFS mount daemon which carries out the requests that nfsd passes on to it.&lt;br /&gt;    * rpcbind This daemon allows NFS clients to discover which port the NFS server is using. &lt;br /&gt;&lt;br /&gt;# NAS uses TCP/IP and NFS/CIFS/HTTP&lt;br /&gt;# NAS uses TCP/IP Networks: Ethernet, FDDI, ATM&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7374815349181726635?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7374815349181726635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7374815349181726635' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7374815349181726635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7374815349181726635'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/network-file-systemnfs.html' title='Network File System(NFS)'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-1520851666449973797</id><published>2009-02-27T01:45:00.000-08:00</published><updated>2009-02-27T01:46:51.363-08:00</updated><title type='text'></title><content type='html'>vi Editor, Learn vi&lt;br /&gt;About vi editor&lt;br /&gt;&lt;br /&gt;    * vi is Found on Nearly Every Unix Computer&lt;br /&gt;    * vi is the standard Unix editor&lt;br /&gt;    * vi is Powerful and Fast&lt;br /&gt;    * Your terminal displays a section of the file you are editing&lt;br /&gt;    * vi can do anything you want&lt;br /&gt;    * You don't need to remove your fingers from the standard typing keys-the keys themselves give commands to vi&lt;br /&gt;    * vi Stays Out of Your Way&lt;br /&gt;    * vi has no menus&lt;br /&gt;    * vi commands are short &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Starting vi&lt;br /&gt;Open a file with vi.&lt;br /&gt;Type: vi myfile.txt&lt;br /&gt;If myfile.txt does not exist, a screen will appear with just a cursor at the top followed by tildes (~) in the first column.&lt;br /&gt;&lt;br /&gt;If myfile.txt does exist, the first few line of the file will appear.&lt;br /&gt;&lt;br /&gt;The status line at the bottom of your screen shows error messages and provides information and feedback, including the name of the file.&lt;br /&gt;&lt;br /&gt;vi Modes&lt;br /&gt;&lt;br /&gt;Command Mode&lt;br /&gt;&lt;br /&gt;# Command mode is the mode you are in when you start (default mode)&lt;br /&gt;# Command mode is the mode in which commands are given to move around in the file, to make changes, and to leave the file&lt;br /&gt;# Commands are case sensitive: j not the same as J&lt;br /&gt;# Most commands do not appear on the screen as you type them. Some commands will appear on the last line: : / ?&lt;br /&gt;&lt;br /&gt;Insert (or Text) Mode&lt;br /&gt;&lt;br /&gt;# The mode in which text is created. (You must press at the end of each line unless you've set wrap margin.)&lt;br /&gt;# There is more than one way to get into insert mode but only one way to leave: return to command mode by pressing&lt;br /&gt;# When in doubt about which mode you are in, press&lt;br /&gt;&lt;br /&gt;Basic Cursor Movement&lt;br /&gt;k  Up one line&lt;br /&gt;j  Down one line&lt;br /&gt;h  Left one character&lt;br /&gt;l  Right one character (or use )&lt;br /&gt;w  Right one word&lt;br /&gt;b  Left one word&lt;br /&gt;&lt;br /&gt;NOTE: Many vi commands can take a leading count (e. g., 6k, 7e).&lt;br /&gt;&lt;br /&gt;Entering, Deleting, and Changing Text&lt;br /&gt;i  Enter text entry mode&lt;br /&gt;x  Delete a character&lt;br /&gt;dd  Delete a line&lt;br /&gt;r  Replace a character&lt;br /&gt;R  Overwrite text, press to end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Setting Basic Options in vi&lt;br /&gt;Displaying Line Numbers&lt;br /&gt;:set nu  Display line numbers&lt;br /&gt;:set nonu  Hide line numbers&lt;br /&gt;&lt;br /&gt;Setting Right Margin&lt;br /&gt;:set wm=number  Set Wrap Margin number of spaces from right edge of screen&lt;br /&gt;:set wm=10  Set Wrap Margin 10 spaces from right edge of screen&lt;br /&gt;:set wm=0  Turn off Wrap Margin&lt;br /&gt;&lt;br /&gt;Exiting vi&lt;br /&gt;To exit you must be in command mode-press if you are not in command mode&lt;br /&gt;&lt;br /&gt;You must press after commands that begin with a : (colon)&lt;br /&gt;ZZ  Write (if there were changes), then quit&lt;br /&gt;:wq  Write, then quit&lt;br /&gt;:q   Quit (will only work if file has not been changed)&lt;br /&gt;:q!  Quit without saving changes to file&lt;br /&gt;&lt;br /&gt;# Basics Summary&lt;br /&gt;A Basic vi Session&lt;br /&gt;To enter vi, type: vi filename&lt;br /&gt;To enter insert mode, type: i&lt;br /&gt;Type in the text: This is easy.&lt;br /&gt;To leave insert mode and return to command mode, press:&lt;br /&gt;In command mode, save changes and exit vi by typing: :wq&lt;br /&gt;You are back at the Unix prompt.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;INTERMEDIATE VI&lt;br /&gt;More On Cursor Movement&lt;br /&gt;e  Move to end of current word&lt;br /&gt;$  Move to end of current line&lt;br /&gt;^  Move to beginning of current line&lt;br /&gt;+  Move to beginning of next line&lt;br /&gt;-  Move to beginning of previous line&lt;br /&gt;G  Go to last line of the file&lt;br /&gt;:n  Go to line with this number (:10 goes to line 10)&lt;br /&gt;d  Scroll down one-half screen&lt;br /&gt;u  Scroll up one-half screen&lt;br /&gt;f  Scroll forward one full screen&lt;br /&gt;b  Scroll backward one full screen&lt;br /&gt;)  Move to the next sentence&lt;br /&gt;(  Move to the previous sentence&lt;br /&gt;}  Move to the next paragraph&lt;br /&gt;{  Move to the previous paragraph&lt;br /&gt;H  Move to the top line of the screen&lt;br /&gt;M  Move to the middle line of the screen&lt;br /&gt;L  Move to the last line of the screen&lt;br /&gt;%  Move to matching bracket: ( { [ ] } )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Entering Text Mode&lt;br /&gt;i  Insert text before current character&lt;br /&gt;a  Append text after current character&lt;br /&gt;I  Begin text insertion at the beginning of a line&lt;br /&gt;A  Append text at end of a line&lt;br /&gt;o  Open a new line below current line&lt;br /&gt;O  Open a new line above current line&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Commands and Objects&lt;br /&gt;Format Example&lt;br /&gt;operator number object c2w&lt;br /&gt;number operator object 2cw&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Operators&lt;br /&gt;c  change&lt;br /&gt;d  delete&lt;br /&gt;y  yank&lt;br /&gt;&lt;br /&gt;Objects and Locations&lt;br /&gt;w  one word forward&lt;br /&gt;b  one word backward&lt;br /&gt;e  end of word&lt;br /&gt;H, M, L  top, middle, or bottom line on screen&lt;br /&gt;), (  next sentence, previous sentence&lt;br /&gt;}, {  next paragraph, previous paragraph&lt;br /&gt;^, $  beginning of line, end of line&lt;br /&gt;/pattern/  forward to pattern&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Replacing and Changing Text&lt;br /&gt;r Replace only the character under the cursor. (Note: using r you remain in command mode.)&lt;br /&gt;R Beginning with the character under the cursor, replace as many characters on this line as you want. (You are in overtype mode until you press&lt;br /&gt;cw Beginning with the character under the cursor, change a word to whatever you type. (You are in insert mode until you press )&lt;br /&gt;c$ Beginning with the character under the cursor,&lt;br /&gt;C change a line to whatever you type. (You are in insert mode until you press )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Deleting Text&lt;br /&gt;x  Delete a character&lt;br /&gt;dw  Delete an alphabetic word and the following space (6dw deletes six words)&lt;br /&gt;dW  Delete a blank-delimited word and the following space&lt;br /&gt;dd  Delete a line (6dd deletes six lines)&lt;br /&gt;d$  Delete all characters to the end of the line.&lt;br /&gt;d}  Delete all characters to the end of the paragraph.&lt;br /&gt;:5,30d  Delete lines 5 through 30&lt;br /&gt;&lt;br /&gt;Deleted text goes into a temporary buffer that is replaced each time you delete (or copy) more text. The current contents of the buffer can be put back into your file.&lt;br /&gt;&lt;br /&gt;Copying and Pasting Text&lt;br /&gt;yy  Copy (yank) the current line&lt;br /&gt;6yy  Copy (yank) six lines, beginning with the current line&lt;br /&gt;yw  Copy the current word&lt;br /&gt;p  Put the text after the cursor position&lt;br /&gt;P  Put the text before the cursor position&lt;br /&gt;Copied text goes into a temporary buffer that is replaced each time you copy (or delete) more text. Only the current contents of the temporary buffer can be put back into your file. As a result, when you use copy (y), use the put (p) command immediately.&lt;br /&gt;&lt;br /&gt;A yank and put procedure using colon commands:&lt;br /&gt;:5,10y Copy lines 5-10&lt;br /&gt;&lt;br /&gt;Move cursor&lt;br /&gt;:put Put after cursor&lt;br /&gt;&lt;br /&gt;Other Useful Commands&lt;br /&gt;.  Repeat last command&lt;br /&gt;n.  Repeat last command n number of times&lt;br /&gt;J  Join next line to current line&lt;br /&gt;u  Undo last single change&lt;br /&gt;U  Restore current line&lt;br /&gt;~  Change letter's case (capital to lower and vice versa)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Buffers&lt;br /&gt;Temporary Buffer&lt;br /&gt;Deleted or copied text goes into a temporary unnamed buffer. The contents of the temporary buffer may be retrieved by using the p or P commands.&lt;br /&gt;p  Put words from temporary buffer after cursor or put lines from temporary buffer below current line&lt;br /&gt;P  Put words from temporary buffer before cursor or put lines from temporary buffer above current line&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lettered Buffers&lt;br /&gt;There are 26 lettered buffers (a-z). Contents of a lettered buffer are saved until you copy or delete more characters into it, or until you quit your current vi session.&lt;br /&gt;"ayy  Copy (yank) a line into buffer a&lt;br /&gt;"Ayy  Appends to buffer a&lt;br /&gt;"a10yy  Copies 10 lines into buffer a&lt;br /&gt;"a10dd  Deletes 10 lines of text into buffer a&lt;br /&gt;"ap  Put contents of lettered buffer a below the current line&lt;br /&gt;&lt;br /&gt;Both temporary and lettered buffers last only for the current vi session.&lt;br /&gt;&lt;br /&gt;Copying, Deleting, or Moving Text Using Line Numbers&lt;br /&gt;These commands start with a colon (:) and end with a or g shows the line number of the current line&lt;br /&gt;The basic form of colon commands is&lt;br /&gt;&lt;br /&gt;:beginning_line, ending_line command destination&lt;br /&gt;&lt;br /&gt;where destination is the line after which you want the text placed.&lt;br /&gt;:5,10 co 105  Copy lines 5-10 to the line after 105&lt;br /&gt;:5,20 m $  Move lines 5-20 to end of file&lt;br /&gt;:7,300 d  Delete lines 7-300 (to buffer)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Searching for Text&lt;br /&gt;/text  Search forward (down) for text (text can include spaces and characters with special meanings.)&lt;br /&gt;?text  Search backward (up) for text&lt;br /&gt;n  Repeat last search in the same direction&lt;br /&gt;N  Repeat last search in the opposite direction&lt;br /&gt;fchar  Search forward for a charcter on current line&lt;br /&gt;Fchar  Search backward for a character on current line&lt;br /&gt;;  Repeat last character search in the same direction&lt;br /&gt;%  Find matching ( ), { }, or [ ]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Substitutions&lt;br /&gt;The simplest way to do substitutions over a range of lines, or throughout the file, is to use the s colon command. The basic form of this command is the following:&lt;br /&gt;&lt;br /&gt;:n1,n2s/old/new/gc&lt;br /&gt;n1  is the beginning line&lt;br /&gt;n2  is the ending line number&lt;br /&gt;s  means to substitute text matching the pattern (old) with text specified by (new)&lt;br /&gt;g (global)  is optional. It indicates you want to substitute all occurrences on the indicated lines. If you use g, the editor substitutes only the first occurrence on the indicated lines.&lt;br /&gt;c (confirm) is optional. It indicates you want to confirm each substitution before vi completes it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;:%s/old/new/g  Substitutes old with new throughout the file&lt;br /&gt;:.,$s/old/new/g  Substitutes old with new from the current cursor position to the end of the file&lt;br /&gt;:^,.s/old/new/g  Substitutes old with new from the beginning of the file to the current cursor position&lt;br /&gt;:&amp;  Repeats the last substitute (:s) command&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ADVANCED VI TUTORIAL&lt;br /&gt;&lt;br /&gt;Writing to and Reading from Files&lt;br /&gt;:w file  Write current file to file&lt;br /&gt;:w&gt;&gt;file  Append current file to file&lt;br /&gt;:5,10w file  Write lines 5 through 10 to file&lt;br /&gt;:5,10w&gt;&gt;file  Append Lines 5 through 10 to file&lt;br /&gt;:r file  Read a copy of file into current file&lt;br /&gt;:!ls  See a list of files in your current directory&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;More About Options From Command Mode-within vi for the current file only&lt;br /&gt;:set all  Display all options&lt;br /&gt;:set  Display current settings of options&lt;br /&gt;:set nooption  Unset option&lt;br /&gt;:set ai  Set Auto Indentation during text entry&lt;br /&gt;:set ic  Set Ignore Case during searches&lt;br /&gt;:set nu  Show line Numbers&lt;br /&gt;:set sm  Show Matching ( or { when ) or } is entered&lt;br /&gt;:set wm=10  Set Wrap Margin 10 spaces from right edge of screen&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Customizing vi Sessions Options can be set four ways:&lt;br /&gt;# During a vi session&lt;br /&gt;&lt;br /&gt;    * :set nu&lt;br /&gt;&lt;br /&gt;# In a .exrc file in your home directory. Sample contents of a .exrc file&lt;br /&gt;&lt;br /&gt;    * set nu&lt;br /&gt;    * set ai&lt;br /&gt;    * set wm=10 &lt;br /&gt;&lt;br /&gt;# In a .exrc file in a subdirectory.&lt;br /&gt;# By setting the EXINIT environmental variable. Example of setting the EXINIT environmental variable&lt;br /&gt;&lt;br /&gt;    * setenv EXINIT "set nu ai ic"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Order of Precedence&lt;br /&gt;# If a .exrc file exists in the current directory, vi reads it when beginning a session.&lt;br /&gt;# If no .exrc file exists in the current directory, vi checks the home directory for a .exrc file. If such a file exists, vi reads it when beginning a session.&lt;br /&gt;# If no .exrc file is found, vi uses its defaults.&lt;br /&gt;# Values set in the EXINIT environmental variable override any values set in a .exrc file.&lt;br /&gt;&lt;br /&gt;Creating a .exrc File&lt;br /&gt;&lt;br /&gt;At the system prompt, type: vi .exrc&lt;br /&gt;Type the following commands, each on a separate line:&lt;br /&gt;# set ai&lt;br /&gt;# set ic&lt;br /&gt;# set nu&lt;br /&gt;# set wm=8 Do not leave blank lines at the beginning or end of the .exrc file.&lt;br /&gt;When you are finished, type: ZZ&lt;br /&gt;&lt;br /&gt;Abbreviations &amp; Mapping&lt;br /&gt;Abbreviations are text strings that automatically expand into larger strings during insert mode.&lt;br /&gt;:ab UW University of Washington&lt;br /&gt;&lt;br /&gt;Mapping defines a single key to execute a sequence of keystrokes when the single key is pressed in command mode. In the following example,the @ key is mapped to replace the current word with "University of Washington". The v allows you to enter the key into the command sequence.&lt;br /&gt;:map @ cwUniversity of Washington v&lt;br /&gt;&lt;br /&gt;Mapping can also be used to call commands external to vi, such as sort or fmt. In the following example, the @ sign is mapped to the sort command, so that the current paragraph (indicated by the }) will be sorted. The v allows you to enter the key into the command sequence. The second completes the map command.&lt;br /&gt;:map @ !}sort v&lt;br /&gt;&lt;br /&gt;Note: You can also put abbreviation and mapping commands in your .exrc file.&lt;br /&gt;&lt;br /&gt;TIPS AND TRICKS&lt;br /&gt;&lt;br /&gt;Find the line that reads&lt;br /&gt;editor=&lt;br /&gt;Change it to read&lt;br /&gt;editor=vi&lt;br /&gt;Write and quit the file. (ZZ or :wq) vi-ing More Than One File&lt;br /&gt;You can edit more than one file at a time with vi.&lt;br /&gt;From The Unix Shell Prompt&lt;br /&gt;vi file1 file2 vi two (or more) files at the same time From Command Mode&lt;br /&gt;:n  Move to file2 from file1&lt;br /&gt;:rew  Rewind back to file1&lt;br /&gt;:e!  Restore original file1 file2 (start all over)&lt;br /&gt;ZZ  Save and quit file. (Must be done for each file.)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Moving the Left Margin&lt;br /&gt;When you print a file you may want the left margin moved to the right. This leaves room for a three-hole punch.&lt;br /&gt;:1,$&gt;  Move entire file 1 shift width (eight spaces) to the right&lt;br /&gt;:1,$&lt;  Move entire file eight spaces to the left&lt;br /&gt;:%s/^/ /g  Insert any number of spaces at the beginning of each line in the entire file. Simply press the space bar the desired number of times.&lt;br /&gt;:20&gt;&gt;  Moves next 20 lines over 1 shift width.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Issuing Shell Commands From vi&lt;br /&gt;You can issue a single shell command while in the vi editor. For example, to list the files in your directory (ls), follow these steps:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Press d to return to vi editing.&lt;br /&gt;&lt;br /&gt;Double Spacing a File&lt;br /&gt;Occasionally, you may want a double spaced version of your file for editing or review.&lt;br /&gt;:w  Write changes to your file (just in case).&lt;br /&gt;:!ls  List contents of your current directory on the screen. Press to return to vi. You can issue many shell commands by temporarily leaving the vi editor. From Command Mode&lt;br /&gt;:w  Write changes to your file.&lt;br /&gt;:sh  Return to the shell to enter a number of commands without leaving vi.&lt;br /&gt;:w  original.backup Save a backup copy of the original file&lt;br /&gt;:%! sed G  Double space the entire file.&lt;br /&gt;:1,5! sed G  Double space the lines from 1-5.&lt;br /&gt;ye&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-1520851666449973797?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/1520851666449973797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=1520851666449973797' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1520851666449973797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1520851666449973797'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/vi-editor-learn-vi-about-vi-editor-vi.html' title=''/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6453585700509224000</id><published>2009-02-27T01:43:00.000-08:00</published><updated>2009-02-27T01:44:06.586-08:00</updated><title type='text'>Some Important GNU/Linux commands</title><content type='html'>alias  Create an alias&lt;br /&gt;awk  Find and Replace text, database sort/validate/indexbreak&lt;br /&gt;cal  Display a calendar&lt;br /&gt;case  Conditionally perform a command&lt;br /&gt;cat  Display the contents of a file&lt;br /&gt;cd  Change Directory&lt;br /&gt;cfdisk  Partition table manipulator for Linuxchgrp&lt;br /&gt;chroot  Run a command with a different root directory&lt;br /&gt;cksum  Print CRC checksum and byte counts&lt;br /&gt;clear  Clear terminal screen&lt;br /&gt;cmp  Compare two files&lt;br /&gt;comm  Compare two sorted files line by line&lt;br /&gt;command  Run a command - ignoring shell functions&lt;br /&gt;continue  Resume the next iteration of a loop&lt;br /&gt;cp  Copy one or more files to another&lt;br /&gt;crontab  Schedule a command to run at a later timec&lt;br /&gt;split  Split a file into context-determined pieces&lt;br /&gt;cut  Divide a file into several parts&lt;br /&gt;date  Display or change the date &amp; time&lt;br /&gt;dc  Desk Calculator&lt;br /&gt;dd  Data Dump - Convert and copy a file&lt;br /&gt;declare  Declare variables and give them attributes&lt;br /&gt;df  Display free disk space&lt;br /&gt;diff  Display the differences between two files&lt;br /&gt;diff3  Show differences among three files&lt;br /&gt;dir  Briefly list directory contents&lt;br /&gt;dircolors Colour setup for `ls'&lt;br /&gt;dirname  Convert a full pathname to just a path&lt;br /&gt;dirs  Display list of remembered directories&lt;br /&gt;du  Estimate file space usage&lt;br /&gt;echo  Display message on screen&lt;br /&gt;ed  A line-oriented text editor (edlin)&lt;br /&gt;egrep  Search file(s) for lines that match an extended expression&lt;br /&gt;eject  Eject CD-ROM&lt;br /&gt;enable  Enable and disable builtin shell commands&lt;br /&gt;env  Display, set, or remove environment variables&lt;br /&gt;eval  Evaluate several commands/arguments&lt;br /&gt;exec  Execute a command&lt;br /&gt;exit  Exit the shell&lt;br /&gt;expand  Convert tabs to spaces&lt;br /&gt;export  Set an environment variable&lt;br /&gt;expr  Evaluate expressions&lt;br /&gt;factor  Print prime factors&lt;br /&gt;false  Do nothing, unsuccessfully&lt;br /&gt;fdformat Low-level format a floppy disk&lt;br /&gt;fdisk  Partition table manipulator for Linux&lt;br /&gt;fgrep  Search file(s) for lines that match a fixed string&lt;br /&gt;find  Search for files that meet a desired criteria&lt;br /&gt;fmt  Reformat paragraph text&lt;br /&gt;fold  Wrap text to fit a specified width.&lt;br /&gt;for  Expand words, and execute commands&lt;br /&gt;format  Format disks or tapes&lt;br /&gt;free  Display memory usage&lt;br /&gt;fsck  Filesystem consistency check and repair.&lt;br /&gt;function Define Function Macros&lt;br /&gt;gawk  Find and Replace text within file(s)&lt;br /&gt;getopts  Parse positional parameters&lt;br /&gt;grep  Search file(s) for lines that match a given pattern&lt;br /&gt;groups  Print group names a user is in&lt;br /&gt;gzip  Compress or decompress named file(s)&lt;br /&gt;hash  Remember the full pathname of a name argument&lt;br /&gt;head  Output the first part of file(s)&lt;br /&gt;history  Command History&lt;br /&gt;hostname  Print or set system name&lt;br /&gt;id  Print user and group id's&lt;br /&gt;if  Conditionally perform a command&lt;br /&gt;import  Capture an X server screen and save the image to file&lt;br /&gt;info  Help info&lt;br /&gt;install  Copy files and set attributes&lt;br /&gt;join  Join lines on a common field&lt;br /&gt;kill  Stop a process from running&lt;br /&gt;less  Display output one screen at a time&lt;br /&gt;let  Perform arithmetic on shell variables&lt;br /&gt;ln  Make links between files&lt;br /&gt;local  Create variables&lt;br /&gt;locate  Find files&lt;br /&gt;logname Print current login name&lt;br /&gt;logout  Exit a login shell&lt;br /&gt;lpc  Line printer control program&lt;br /&gt;lpr  Off line print&lt;br /&gt;lprint  Print a file&lt;br /&gt;lprintd  Abort a print job&lt;br /&gt;lprintq  List the print queue&lt;br /&gt;lprm  Remove jobs from the print queue&lt;br /&gt;ls  List information about file(s)&lt;br /&gt;m4  Macro processor&lt;br /&gt;man  Help manual&lt;br /&gt;mkdir  Create new folder(s)&lt;br /&gt;mkfifo  Make FIFOs (named pipes)&lt;br /&gt;mknod  Make block or character special files&lt;br /&gt;more  Display output one screen at a time&lt;br /&gt;mount  Mount a file system&lt;br /&gt;mtools  Manipulate MS-DOS files&lt;br /&gt;mv  Move or rename files or directories&lt;br /&gt;nice  Set the priority of a command or job&lt;br /&gt;nl  Number lines and write files&lt;br /&gt;nohup  Run a command immune to hangups&lt;br /&gt;passwd  Modify a user password&lt;br /&gt;paste  Merge lines of files&lt;br /&gt;pathchk  Check file name portability&lt;br /&gt;popd  Restore the previous value of the current directory&lt;br /&gt;pr  Convert text files for printing&lt;br /&gt;printcap  Printer capability database&lt;br /&gt;printenv Print environment variables&lt;br /&gt;printf  Format and print data&lt;br /&gt;ps  Process status&lt;br /&gt;pushd  Save and then change the current directory&lt;br /&gt;pwd  Print Working Directory&lt;br /&gt;quota  Display disk usage and limits&lt;br /&gt;quotacheck Scan a file system for disk usage&lt;br /&gt;quotactl  Set disk quotas&lt;br /&gt;ram  ram disk device&lt;br /&gt;rcp  Copy files between two machines.&lt;br /&gt;read  read a line from standard input&lt;br /&gt;readonly Mark variables/functions as readonly&lt;br /&gt;remsync  Synchronize remote files via email&lt;br /&gt;return  Exit a shell function&lt;br /&gt;rm  Remove files&lt;br /&gt;rmdir  Remove folder(s)&lt;br /&gt;rpm  Remote Package Manager&lt;br /&gt;rsync  Remote file copy (Synchronize file trees)&lt;br /&gt;screen  Terminal window manager&lt;br /&gt;sdiff  Merge two files interactively&lt;br /&gt;sed  Stream Editor&lt;br /&gt;select  Accept keyboard input&lt;br /&gt;seq  Print numeric sequences&lt;br /&gt;set  Manipulate shell variables and functions&lt;br /&gt;shift  Shift positional parameters&lt;br /&gt;shopt  Shell Options&lt;br /&gt;shutdown Shutdown or restart linux&lt;br /&gt;sleep  Delay for a specified time&lt;br /&gt;sort  Sort text files&lt;br /&gt;source  Run commands from a file `.'&lt;br /&gt;split  Split a file into fixed-size pieces&lt;br /&gt;su  Substitute user identity&lt;br /&gt;sum  Print a checksum for a file&lt;br /&gt;symlink Make a new name for a file&lt;br /&gt;sync  Synchronize data on disk with memory&lt;br /&gt;tac  Concatenate and write files in reverse&lt;br /&gt;tail  Output the last part of files&lt;br /&gt;tar  Tape ARchiver&lt;br /&gt;tee  Redirect output to multiple files&lt;br /&gt;test  Evaluate a conditional expression&lt;br /&gt;time  Measure Program Resource Use&lt;br /&gt;times  User and system times&lt;br /&gt;touch  Change file timestamps&lt;br /&gt;top  List processes running on the system&lt;br /&gt;traceroute Trace Route to Host&lt;br /&gt;trap  Run a command when a signal is set(bourne)&lt;br /&gt;tr  Translate, squeeze, and/or delete characters&lt;br /&gt;true  Do nothing, successfully&lt;br /&gt;tsort  Topological sort&lt;br /&gt;tty  Print filename of terminal on stdin&lt;br /&gt;type  Describe a command&lt;br /&gt;ulimit  Limit user resources&lt;br /&gt;umask  Users file creation mask&lt;br /&gt;umount  Unmount a device&lt;br /&gt;unalias  Remove an alias&lt;br /&gt;uname  Print system information&lt;br /&gt;unexpand Convert spaces to tabs&lt;br /&gt;uniq  Uniquify files&lt;br /&gt;units  Convert units from one scale to another&lt;br /&gt;unset  Remove variable or function names&lt;br /&gt;unshar  Unpack shell archive scripts&lt;br /&gt;until  Execute commands (until error)&lt;br /&gt;useradd  Create new user account&lt;br /&gt;usermod  Modify user account&lt;br /&gt;users  List users currently logged in&lt;br /&gt;uuencode Encode a binary file uudecode Decode a file created by uuencode&lt;br /&gt;v  Verbosely list directory contents (`ls -l -b')&lt;br /&gt;vdir  Verbosely list directory contents (`ls -l -b')&lt;br /&gt;watch  Execute/display a program periodically&lt;br /&gt;wc  Print byte, word, and line counts&lt;br /&gt;whereis Report all known instances of a command&lt;br /&gt;which  Locate a program file in the user's path.&lt;br /&gt;while  Execute commands&lt;br /&gt;who  Print all usernames currently logged in&lt;br /&gt;whoami  Print the current user id and name (`id -un')&lt;br /&gt;xargs  Execute utility, passing constructed argument list(s)&lt;br /&gt;yes  Print a string until interrupted&lt;br /&gt;.period  Run commands from a file&lt;br /&gt;###  Comment / Remark&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6453585700509224000?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6453585700509224000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6453585700509224000' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6453585700509224000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6453585700509224000'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/some-important-gnulinux-commands.html' title='Some Important GNU/Linux commands'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-5626115124954267888</id><published>2009-02-27T01:42:00.003-08:00</published><updated>2009-02-27T01:42:58.822-08:00</updated><title type='text'>grep usage</title><content type='html'>grep usage&lt;br /&gt;------------------&lt;br /&gt;Here is an example shell command that invokes GNU grep:&lt;br /&gt;&lt;br /&gt;  grep -i 'hello.*world' hello.h hello.c&lt;br /&gt;&lt;br /&gt;This lists all lines in the files `hello.h' and `hello.c' that contain the string `hello' followed by the string `world'; this is because `.*' matches zero or more characters within a line. See section 5. Regular Expressions. The `-i' option causes grep to ignore case, causing it to match the line `Hello, world!', which it would not otherwise match. Invoking grep, for more details about how to invoke grep.&lt;br /&gt;&lt;br /&gt;Here are some common questions and answers about grep usage.&lt;br /&gt;&lt;br /&gt;How can I list just the names of matching files?&lt;br /&gt;&lt;br /&gt;  grep -l 'main' *.c&lt;br /&gt;&lt;br /&gt;lists the names of all C files in the current directory whose contents mention `main'. How do I search directories recursively?&lt;br /&gt;&lt;br /&gt;  grep -r 'hello' /home/test&lt;br /&gt;&lt;br /&gt;searches for `hello' in all files under the directory `/home/test'. For more control of which files are searched, use find, grep and xargs. For example, the following command searches only C files:&lt;br /&gt;&lt;br /&gt;find /home/test -name '*.c' -print | xargs grep 'hello' /dev/null&lt;br /&gt;&lt;br /&gt;This differs from the command:&lt;br /&gt;&lt;br /&gt;  grep -r 'hello' *.c&lt;br /&gt;&lt;br /&gt;which merely looks for `hello' in all files in the current directory whose names end in `.c'. Here the `-r' is probably unnecessary, as recursion occurs only in the unlikely event that one of `.c' files is a directory. What if a pattern has a leading `-'?&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  grep -e '--cut here--' *&lt;br /&gt;&lt;br /&gt;searches for all lines matching `--cut here--'. Without `-e', grep would attempt to parse `--cut here--' as a list of options. Suppose I want to search for a whole word, not a part of a word?&lt;br /&gt;&lt;br /&gt;  grep -w 'hello' *&lt;br /&gt;&lt;br /&gt;searches only for instances of `hello' that are entire words; it does not match `Othello'. For more control, use `&lt;' and `&gt;' to match the start and end of words. For example:&lt;br /&gt;&lt;br /&gt;  grep 'hello&gt;' *&lt;br /&gt;&lt;br /&gt;searches only for words ending in `hello', so it matches the word `Othello'. How do I output context around the matching lines?&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  grep -C 2 'hello' *&lt;br /&gt;&lt;br /&gt;prints two lines of context around each matching line. How do I force grep to print the name of the file?&lt;br /&gt;&lt;br /&gt;Append `/dev/null': &lt;br /&gt;grep 'eli' /etc/passwd /dev/null&lt;br /&gt;&lt;br /&gt;gets you:&lt;br /&gt;/etc/passwd:bill:TWEFWEG.IMe.:98:11:Bill Gates:/home/do/bgates:/bin/bash Why do people use strange regular expressions on ps output?&lt;br /&gt;&lt;br /&gt;  ps -ef | grep '[c]ron'&lt;br /&gt;&lt;br /&gt;If the pattern had been written without the square brackets, it would have matched not only the ps output line for cron, but also the ps output line for grep. Note that some platforms ps limit the ouput to the width of the screen, grep does not have any limit on the length of a line except the available memory. Why does grep report "Binary file matches"?&lt;br /&gt;If grep listed all matching "lines" from a binary file, it would probably generate output that is not useful, and it might even muck up your display. So GNU grep suppresses output from files that appear to be binary files. To force GNU grep to output lines even from files that appear to be binary, use the `-a' or `--binary-files=text' option. To eliminate the "Binary file matches" messages, use the `-I' or `--binary-files=without-match' option. Why doesn't `grep -lv' print nonmatching file names?&lt;br /&gt;`grep -lv' lists the names of all files containing one or more lines that do not match. To list the names of all files that contain no matching lines, use the `-L' or `--files-without-match' option.&lt;br /&gt;I can do OR with `|', but what about AND?&lt;br /&gt;&lt;br /&gt;   grep 'paul' /etc/motd | grep 'franc,ois'&lt;br /&gt;&lt;br /&gt;finds all lines that contain both `paul' and `franc,ois'. How can I search in both standard input and in files?&lt;br /&gt;Use the special file name `-':&lt;br /&gt;&lt;br /&gt;    cat /etc/passwd | grep 'alain' - /etc/motd&lt;br /&gt;&lt;br /&gt;How to express palindromes in a regular expression? It can be done by using the back referecences, for example a palindrome of 4 chararcters can be written in BRE.&lt;br /&gt;&lt;br /&gt;     grep -w -e '(.)(.).21' file&lt;br /&gt;&lt;br /&gt;It matches the word "radar" or "civic".&lt;br /&gt;Guglielmo Bondioni proposed a single RE that finds all the palindromes up to 19 characters long.&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;  egrep -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?987654321$' file&lt;br /&gt;&lt;br /&gt;Note this is done by using GNU ERE extensions, it might not be portable on other greps. Why are my expressions whith the vertical bar fail?&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;  /bin/echo "ba" | egrep '(a)1|(b)1'&lt;br /&gt;&lt;br /&gt;The first alternate branch fails then the first group was not in the match this will make the second alternate branch fails. For example, "aaba" will match, the first group participate in the match and can be reuse in the second branch. What do grep, fgrep, egrep stand for ?&lt;br /&gt;grep comes from the way line editing was done on Unix. For example, ed uses this syntax to print a list of matching lines on the screen.&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;  global/regular expression/print&lt;br /&gt;g/re/p&lt;br /&gt;&lt;br /&gt;fgrep stands for Fixed grep, egrep Extended grep.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-5626115124954267888?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/5626115124954267888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=5626115124954267888' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5626115124954267888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/5626115124954267888'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/grep-usage.html' title='grep usage'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-2842750670061153948</id><published>2009-02-27T01:42:00.001-08:00</published><updated>2009-02-27T01:42:28.810-08:00</updated><title type='text'>Linux find command</title><content type='html'>Linux find command&lt;br /&gt;&lt;br /&gt;The find command allows the Unix user to process a set of files and/or directories in a file subtree.&lt;br /&gt;&lt;br /&gt;You can specify the following:&lt;br /&gt;&lt;br /&gt;    * where to search (pathname)&lt;br /&gt;    * what type of file to search for (-type: directories, data files, links)&lt;br /&gt;    * how to process the files (-exec: run a process against a selected file)&lt;br /&gt;    * the name of the file(s) (-name)&lt;br /&gt;    * perform logical operations on selections (-o and -a)&lt;br /&gt;    * Search for file with a specific name in a set of files (-name) &lt;br /&gt;&lt;br /&gt;find . -name "rc.conf" -print&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This command will search in the current directory and all sub directories for a file named rc.conf.&lt;br /&gt;&lt;br /&gt;Note: The -print option will print out the path of any file that is found with that name. In general -print wil print out the path of any file that meets the find criteria.&lt;br /&gt;&lt;br /&gt;How to apply a unix command to a set of file (-exec).&lt;br /&gt;&lt;br /&gt;find . -name "rc.conf" -exec chmod o+r '{}' \; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This command will search in the current directory and all sub directories. All files named rc.conf will be processed by the chmod -o+r command. The argument '{}' inserts each found file into the chmod command line. The\; argument indicates the exec command line has ended.&lt;br /&gt;&lt;br /&gt;The end results of this command is all rc.conf files have the other permissions set to read access (if the operator is the owner of the file).&lt;br /&gt;&lt;br /&gt;How to apply a complex selection of files (-o and -a).&lt;br /&gt;&lt;br /&gt;find /usr/src -not \( -name "*,v" -o -name ".*,v" \) '{}' \; -print&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This command will search in the /usr/src directory and all sub directories. All files that are of the form '*,v' and '.*,v' are excluded.&lt;br /&gt;&lt;br /&gt;Important arguments to note are:&lt;br /&gt;&lt;br /&gt;    * -not means the negation of the expression that follows&lt;br /&gt;    * \( means the start of a complex expression.&lt;br /&gt;    * \) means the end of a complex expression.&lt;br /&gt;    * -o means a logical or of a complex expression. &lt;br /&gt;&lt;br /&gt;In this case the complex expression is all files like '*,v' or '.*,v'&lt;br /&gt;The above example is shows how to select all file that are not part of the RCS system. This is important when you want go through a source tree and modify all the source files... but ... you don't want to affect the RCS version control files.&lt;br /&gt;&lt;br /&gt;How to search for a string in a selection of files (-exec grep ...).&lt;br /&gt;&lt;br /&gt;find . -exec grep "searchthisstring" '{}' \; -print &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This command will search in the current directory and all sub directories. All files that contain the string will have their path printed to standard output.&lt;br /&gt;&lt;br /&gt;If you want to just find each file then pass it on for processing use the -q grep option. This finds the first occurrance of the search string. It then signals success to find and find continues searching for more files.&lt;br /&gt;&lt;br /&gt;find . -exec grep -q "searchthisstring" '{}' \; -print &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This command is very important for process a series of files that contain a specific string. You can then process each file appropriately.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-2842750670061153948?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/2842750670061153948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=2842750670061153948' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2842750670061153948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2842750670061153948'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/linux-find-command.html' title='Linux find command'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3587150917263242239</id><published>2009-02-27T01:41:00.001-08:00</published><updated>2009-02-27T01:41:58.894-08:00</updated><title type='text'>User configuration files: . (dot) files and rc files</title><content type='html'>User configuration files: . (dot) files and rc files&lt;br /&gt;configuration files: the first one at a "system" level, located in /etc/; and the other one, "private" to the user, that can be found in home directory.&lt;br /&gt;&lt;br /&gt;Commonly used rc and . (dot) files&lt;br /&gt;&lt;br /&gt;Filename Description&lt;br /&gt;.bash_login Look at "man bash". Treated by bash like .bash_profileif that doesn't exist.&lt;br /&gt;.bash_logout Look at "man bash".Sourced by bash login shells at exit.&lt;br /&gt;.bash_profile Sourced by bash login shells after /etc/profile.&lt;br /&gt;.bash_history The list of commands executed previously.&lt;br /&gt;.bashrc Look at "man bash". Sourced by bash non-login interactive shells (no other files are). Non-interactive shells source nothing unless BASH_ENV or ENV are set.&lt;br /&gt;.emacs Read by emacs at startup.&lt;br /&gt;.forward If this contains an e-mail address, then all mail to owner of ~ will be forwarded to that e-mail address.&lt;br /&gt;.fvwmrc .fvwm2rc Config files for fvwm and fvwm2 (the basic XWindow manager).&lt;br /&gt;.hushlogin Look at "man login". Causes a "quiet" login (no mail notice, last login info, or MOD).&lt;br /&gt;.mail.rc User init file for mail program.&lt;br /&gt;.ncftp/ Directory for ncftp program; contains bookmarks, log, macros, preferences, trace. See man ncftp. The purpose of ncftp is to provide a powerful and flexible interface to the Internet standard File Transfer Protocol. It is intended to replace the stock ftp program that comes with the system.&lt;br /&gt;.profile Look at "man bash". Treated by bash like ~/.bash_profile if that and .bash_login don't exist, and used by other Bourn- heritage shells too.&lt;br /&gt;.pinerc Pine configuration&lt;br /&gt;.muttrc Mutt configuration&lt;br /&gt;.exrc Configuration of vi can be controlled by this file. Example: set ai sm ruler Writing the above line in this file makes vi set the auto-indentation, matching brackets and displaying line number and rows- columns options.&lt;br /&gt;.vimrc Default "Vim" configuration file. Same as .exrc.&lt;br /&gt;.gtkrc GNOME Toolkit.&lt;br /&gt;.kderc KDE configuration.&lt;br /&gt;.netrc Default login names and passwords for ftp.&lt;br /&gt;.rhosts Used by the r-tools: rsh, rlogin, etc. Very weak security since host impersonation is easy. Must be owned by user (owner of ~/) or superuser. Lists hosts from which users may access this account. Ignored if it is a symbolic link.&lt;br /&gt;.rpmrc See "man rpm". Read by rpm if /etc/rpmrc is not present.&lt;br /&gt;.signature Message text that will be appended automatically to the mail sent from this account.&lt;br /&gt;.twmrc Config file for twm (The Window Manager).&lt;br /&gt;.xinitrc Read by X at startup (not by xinit script). Mostly starts some progs.&lt;br /&gt;Example: exec /usr/sbin/startkde If the above line is present in this file, then the KDE Window Manager is started in when the startx command is issued from this account.&lt;br /&gt;.xmodmaprc This file is passed to the xmodmap program, and could be named anything (.Xmodmap and .keymap.km, for example).&lt;br /&gt;.xserverrc Run by xinit as the X server if it can find X to execute. ~/News/Sent-Message-IDs Default mail history file for gnus.&lt;br /&gt;.Xauthority Read and written by xdm program to handle authorization. See the X, xdm, and xauth man pages.&lt;br /&gt;.Xdefaults,.Xdefaults-hostname Read by X applications during startup on hostname. If the -hostname file can't be found, .Xdefaults is looked for.&lt;br /&gt;.Xmodmap Points to .xmodmaprc; Red Hat had (has) .xinitrc using this name.&lt;br /&gt;.Xresources Usually the name for the file passed to xrdb to load the X resources database, to avoid the need for applications to read a long .Xdefaults file. (~/.Xres has been used by some.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3587150917263242239?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3587150917263242239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3587150917263242239' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3587150917263242239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3587150917263242239'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/user-configuration-files-dot-files-and.html' title='User configuration files: . (dot) files and rc files'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3966578983778615525</id><published>2009-02-27T01:40:00.000-08:00</published><updated>2009-02-27T01:41:10.648-08:00</updated><title type='text'>What is Sticky bit?</title><content type='html'>Sticky bit&lt;br /&gt;&lt;br /&gt;The most common use of the sticky bit today is on directories, where, when set, items inside the directory can only be renamed or deleted by the item's owner, the directory's owner, or the superuser. Generally this is set on the /tmp directory to prevent ordinary users from deleting or moving other users' files.&lt;br /&gt;&lt;br /&gt;In addition, Solaris (as of Solaris 2.5) defines special behavior when the sticky bit is set on non-executable files: those files, when accessed, will not be cached by the kernel. This is usually set on swap files to prevent access on the file from flushing more important data from the system cache. It is also used occasionally for benchmarking tests.&lt;br /&gt;&lt;br /&gt;Examples&lt;br /&gt;The sticky bit can only be set by superuser root. Using the chmod command, it can be set using its octal mode 1000 or by its symbol t (s is already used by the setuid bit). For example, to add the bit on the directory /usr/local/tmp, one would type chmod +t /usr/local/tmp. Or, to make sure that directory has standard tmp permissions, one could also type chmod 1777 /usr/local/tmp.&lt;br /&gt;&lt;br /&gt;In Unix symbolic file system permission notation, the sticky bit is represented by the letter t in the final character-place. For instance, on Solaris 8, the /tmp directory, which by default has the sticky-bit set, shows up as:&lt;br /&gt;&lt;br /&gt;$ ls -ld /tmp&lt;br /&gt;&lt;br /&gt;drwxrwxrwt     4   root    sys    485   Nov   10   06:01   /tmp&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If the sticky-bit is set on a file or directory without the execution bit set for the others category (non-user-owner and non-group-owner), it is indicated with a capital T:&lt;br /&gt;&lt;br /&gt;# ls -l test&lt;br /&gt;&lt;br /&gt;-rw-r--r--     1   root     other     0   Nov 10     12:57   test&lt;br /&gt;&lt;br /&gt;# chmod +t test; ls -l test&lt;br /&gt;&lt;br /&gt;-rw-r--r-T     1   root     other     0   Nov   10   12:57   test&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3966578983778615525?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3966578983778615525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3966578983778615525' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3966578983778615525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3966578983778615525'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/what-is-sticky-bit.html' title='What is Sticky bit?'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6081239671048692828</id><published>2009-02-20T14:27:00.000-08:00</published><updated>2009-02-20T14:29:26.805-08:00</updated><title type='text'>Cpanel /scripts folder with explanation of every script.</title><content type='html'>starts with /scripts/&lt;br /&gt;&lt;br /&gt;adddns - Adds a DNS zone.&lt;br /&gt;addfpmail - Add frontpage mail extensions to all domains without them.&lt;br /&gt;addfpmail2 -Add frontpage mail extensions to all domains without them.&lt;br /&gt;addnetmaskips - Add the netmask 255.255.255.0 to all IPs that have no netmask.&lt;br /&gt;addnobodygrp - Adds the group nobody and activates security.&lt;br /&gt;addpop - Add a Pop Account.&lt;br /&gt;addservlets - Add JSP support to an account (requires tomcat).&lt;br /&gt;addstatus - (Internal use never called by user).&lt;br /&gt;adduser - Add a user to the system.&lt;br /&gt;admin - Run WHM Lite.&lt;br /&gt;apachelimits - Add rlimits to Apache&lt;br /&gt;betaexim - Installs the latest version of exim.&lt;br /&gt;biglogcheck - looks for logs nearing 2 gigabytes in size&lt;br /&gt;bsdcryptoinstall - Installs crypto on FreeBSD.&lt;br /&gt;bsdldconfig - Configures the proper lib directories in FreeBSD.&lt;br /&gt;bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages.&lt;br /&gt;buildbsdexpect - Install expect on FreeBSD.&lt;br /&gt;buildeximconf - Rebuilds exim.conf.&lt;br /&gt;buildpostgrebsd-dev - Installs postgresql on FreeBSD.&lt;br /&gt;checkbadconf - Checks /usr/local/apache/conf/httpd.conf for bad users.&lt;br /&gt;checkbsdgroups - Checks and repairs proftpd ownership on FreeBSD.&lt;br /&gt;checkccompiler - Checks to make sure the C compiler works on your system.&lt;br /&gt;checkfpkey - Checks for the FrontPage suid key&lt;br /&gt;checkgd - Checks to see if GD is built.&lt;br /&gt;checkinterchange - (Internal use).&lt;br /&gt;checklibssl - Checks to make sure the proper libssl symlinks exist.&lt;br /&gt;checkmaxclients - Checks to see if apache has reached the maximum clients allowed.&lt;br /&gt;checkoldperl - Checks to see if the version of Perl on your system is old.&lt;br /&gt;checkrsync - Checks to make sure rsync is up to date.&lt;br /&gt;checksuexecpatch - Checks to see if mailman has been patched for suexec.&lt;br /&gt;checksuspendpages - Checks to see if suspend pages are properly named.&lt;br /&gt;checkup2date - Makes sure up2date is set up properly (RedHat)&lt;br /&gt;checkyum - Makes sure yum is set up properly.&lt;br /&gt;chkpaths - Makes sure /usr/sbin/chown has a symlink to /bin/chown&lt;br /&gt;chownpublichtmls - Change ownership of all users web space to them, which is useful for converting to suexec. Files owned by nobody are deleted.&lt;br /&gt;chpass - Change password.&lt;br /&gt;ckillall - Allows you to kill a process (used like killall).&lt;br /&gt;ckillall2 - Allows you to kill a process.&lt;br /&gt;cleanbw - Cleans up old bandwidth logs.&lt;br /&gt;cleandns8 - Clean up named.conf.&lt;br /&gt;cleangd - Cleans up old GD installs and reinstalls GD&lt;br /&gt;cleanmd5 - Fix CPAN md5 problems.&lt;br /&gt;cleanmsglog - cleans exim’s msglog&lt;br /&gt;cleanupmysqlprivs - Cleans up improper mySQL privileges.&lt;br /&gt;compilers - Disables the usage of compilers for unprivileged users.&lt;br /&gt;convert2maildir - Converts mail from mbox to maildir format and installs courier impap and pop (cpimap is removed).&lt;br /&gt;courierup - Updates/Installs Courier&lt;br /&gt;cpbackup - Runs backups.&lt;br /&gt;distupgrade - Upgrades RedHat to the newest version (for testing only)&lt;br /&gt;dnscluster - Enables DNS clustering.&lt;br /&gt;dnsqueuecron - Adds a cron job to dump the DNS queue.&lt;br /&gt;dnstransfer - Only if the server has a DNS master (sync with DNS master).&lt;br /&gt;downgradefp - Downgrades FrontPage Extensions (to 5.0-0)&lt;br /&gt;dropmysqldb - Drops a mySQL database.&lt;br /&gt;easyapache - Upgrade Apache&lt;br /&gt;editquota - Change a users quota.&lt;br /&gt;enablechkservdwebmail - Enable service checking of webmaild.&lt;br /&gt;enablefileprotect - Protects home directories if file protection is built in apache.&lt;br /&gt;ensurepkg - Installs a FreeBSD package.&lt;br /&gt;ensurerpm - Installs a rpm.&lt;br /&gt;exim3 - Installs exim 3.&lt;br /&gt;exim4 - Installs exim 4.&lt;br /&gt;exim4-rh73test - Installs exim release #260. (RedHat only)&lt;br /&gt;eximcron - Creates a cron job for exim_tidy_db.&lt;br /&gt;eximlocalsend - Enables/Disables exim local sending.&lt;br /&gt;exim_tidydb - Cleans the exim message log.&lt;br /&gt;eximup - Installs/Updates exim.&lt;br /&gt;fetchgd - Includes libg.so.&lt;br /&gt;findhacks - Search for common Trojan Horses.&lt;br /&gt;findoddrootprocesses - Lists root processes that may need to be checked out.&lt;br /&gt;findphpversion - Check to see if your php version file is up to date.&lt;br /&gt;findtrojans - Exhaustive Trojan Horse search.&lt;br /&gt;fixallcartswithsuexec - Fixes permissions on carts when using suexec.&lt;br /&gt;fixallinterchangeperm - Fixes permissions on all users’ Interchange Shopping Carts.&lt;br /&gt;fixbinpath - Makes sure all bin file paths are correct.&lt;br /&gt;fixbuggynamed - Updates bind to solve any problems with bugs.&lt;br /&gt;fixcommonproblems - Attempt to fix the most common problems.&lt;br /&gt;fixetchosts - Fixes problems with /etc/hosts&lt;br /&gt;fixeverything - Fix common problems and quotas.&lt;br /&gt;fixfpwml - Fix for .wml errors with frontpage.&lt;br /&gt;fixheaders - Run if nothing compiles errors with .h files on compile.&lt;br /&gt;fixinterchange - Reinstall interchange Perl modules.&lt;br /&gt;fixinterchangeperm - fix permissions on a user’s interchange cart.&lt;br /&gt;fixipsnm - Same as addnetmask ips, but Perl though.&lt;br /&gt;fixlibnet - Reinstall Bundle::libnet (Perl).&lt;br /&gt;fixlocalhostwithphp - Change /etc/hosts to work better with PHP 4.2.0 + MySQL.&lt;br /&gt;fixmailman - Updates and restarts mailman.&lt;br /&gt;fixmailmanwithsuexec -&lt;br /&gt;fixmuse - Reinstalls muse.&lt;br /&gt;fixmysql - Fixes problems with mySQL.&lt;br /&gt;fixmysqlbsd - Fixes problesm with mySQL on FreeBSD.&lt;br /&gt;fixnamed - Updates bind to handle many DNS zones (more than 512).&lt;br /&gt;fixndc - Repair redhat’s broken named.conf on 7.2.&lt;br /&gt;fixoldlistswithsuexec - Run after enabling suexec on the server to change the URLs that Mailman gives out to ones that don’t give a 500 internal server error.&lt;br /&gt;fixperl - Symlink /usr/local/bin/perl /usr/bin/perl.&lt;br /&gt;fixperlscript - Makes sure a perlscript includes all corresponding modules.&lt;br /&gt;fixpop - Fix a POP account and reset password.&lt;br /&gt;fixproftpdconf - Fixes problems with /usr/local/etc/proftpd.conf&lt;br /&gt;fixproftpddupes - Updates proftpd.&lt;br /&gt;fixquotas - Fix quotas.&lt;br /&gt;fixrndc - Fixes named.conf to prevent rndc staus failed.&lt;br /&gt;fixspamassassinfailedupdate - Reinstalls a failed spamassassin update.&lt;br /&gt;fixsubdomainlogs - Run if subdomain logs don’t show up in cPanel.&lt;br /&gt;fixsuexeccgiscripts - Fix CGI scripts that are broken after suexec installed.&lt;br /&gt;fixvaliases - Fix permisions on valiases.&lt;br /&gt;fixwebalizer - Repair a Webalizer that has stopped updating.&lt;br /&gt;fp3 - Updates the fpexe3 patch.&lt;br /&gt;fpanonuserpatch - Updates FrontPage extensions to include the anonymous user patch.&lt;br /&gt;ftpcheck - Checks for FTPSSL.&lt;br /&gt;ftpquaotacheck - Runs quota checking for all ftp users.&lt;br /&gt;ftpup - Updates your ftp server.&lt;br /&gt;fullhordereset - Resets Horde and displays the current Horde password.&lt;br /&gt;futexfix - Fixes problesm with futex.&lt;br /&gt;futexstartup - Starts futex.&lt;br /&gt;gcc3 - Installs gcc-3.3.3&lt;br /&gt;gencrt - Generate a .crt and .csr file.&lt;br /&gt;grpck - Checks to see if grpck is working properly.&lt;br /&gt;hdparmify - Enable dma/irq/32bit HD access, which speeds up IDE drives.&lt;br /&gt;hdparmon - Turns on hdparm.&lt;br /&gt;initacls - Mounts your file systems with ACL support (make sure your kernel supports ACLs)&lt;br /&gt;initfpsuexec - Enable FrontPage suexec support.&lt;br /&gt;initquotas - Turn on quota support on new drives.&lt;br /&gt;initsslhttpd - Make sure HTTP starts with SSL.&lt;br /&gt;initsuexec - Turn on suexec support if suexec is installed.&lt;br /&gt;installcgipm - Installs CGI.pm&lt;br /&gt;installdbi - Install Bundle::DBD::mysql.&lt;br /&gt;installfpfreebsd - Installs FrontPage 5 Extensions on FreeBSD.&lt;br /&gt;installfpgentoo - Installs FrontPage on Gentoo.&lt;br /&gt;installgd - Builds GD.&lt;br /&gt;installpkg - Installs a FreeBSD package.&lt;br /&gt;installpostgres - Installs PostrgeSQL.&lt;br /&gt;installrpm - Installs a rpm.&lt;br /&gt;installspam - Install SpamAssassin.&lt;br /&gt;installssl - Add a SSL vhost.&lt;br /&gt;installzendopt - Install zend optimzer.&lt;br /&gt;installzendopt-freebsd - Install zend optimizer on a freebsd machine.&lt;br /&gt;isdedicatedip - Checks an ip to see if it is dedicated.&lt;br /&gt;killacct - Delete an account.&lt;br /&gt;killbadrpms - Security script that kills insecure RPMs from the server.&lt;br /&gt;killdns - Delete a DNS zone.&lt;br /&gt;killdrrootvhost - Removes the document root for a virtual host.&lt;br /&gt;killndbm - Remove the broken NDBM_File module from 7.2.&lt;br /&gt;killpvhost - Removes a virtual host from proftpd.conf.&lt;br /&gt;killspamkeys - Removes a spam key.&lt;br /&gt;killsslvhost - Removes a SSL entry for a virtual host.&lt;br /&gt;killvhost - Delete a vhost.&lt;br /&gt;listcheck - Checks mailing lists for issues.&lt;br /&gt;listproblems - Lists common problems.&lt;br /&gt;listsubdomains - List subdomains.&lt;br /&gt;mailperm - Fix almost any mail permission problem.&lt;br /&gt;mailscannerupdate - Updates MailScanner&lt;br /&gt;mailtroubleshoot - Guided mail fix.&lt;br /&gt;makecpphp - Installs php.&lt;br /&gt;makesecondary - Part of DNS transfer.&lt;br /&gt;manualupcp - Updates cPanel manually.&lt;br /&gt;md5crypt - Encrypts a password into MD5.&lt;br /&gt;mseclocal - Sets up Mandrake’s msec to allow exim to run as mailnull.&lt;br /&gt;mysqladduserdb - Create a MySQL databse and user.&lt;br /&gt;mysqlconnectioncheck - Attempts to connect to MySQL, restarts SQL if necessary.&lt;br /&gt;mysqldeluserdb - Delete a MySQL database and user.&lt;br /&gt;mysqlpasswd - Change MySQL password.&lt;br /&gt;mysqlrpmpingtest - Checks your connection speed for downloading mySQL rpms.&lt;br /&gt;mysqlup - Updates mySQL.&lt;br /&gt;ndbmcheck - Checks to see if the nbdm module is loaded (kills in RedHat 7.2)&lt;br /&gt;netftpsslpatch - Patches FTPSSL.pm.&lt;br /&gt;newexim - Installs the latest version of exim.&lt;br /&gt;nofsck - Make fsck always use -y&lt;br /&gt;nomodattach - Removes mod_attach from httpd.conf.&lt;br /&gt;nomodauthmysql -Removes mod_auth_mysql from httpd.conf.&lt;br /&gt;nomodbwprotect - Removes mod_bwportect from httpd.conf.&lt;br /&gt;nomodgzipconfmods - Removes mod_gzip from httpd.conf.&lt;br /&gt;nomodperl - Removes mod_perl from httpd.conf.&lt;br /&gt;oldaddoncgi2xaddon - Updates old addons to X addons.&lt;br /&gt;park - Parks a domain.&lt;br /&gt;patcheximconf - Fixes exim.conf.&lt;br /&gt;perlinstaller - Installs perl.&lt;br /&gt;phpini - Create a php.ini file.&lt;br /&gt;pingtest - Checks your download time from cPanel mirrors.&lt;br /&gt;pkgaccount-ala - backs up an Alab*nza account for transfer.&lt;br /&gt;pkgacct-ciXost - backs up a ci*ost account for transfer.&lt;br /&gt;pkgacct-dXm - backs up a d*m account for transfer.&lt;br /&gt;pkgacct-enXim - backs up an en*im account for transfer.&lt;br /&gt;pkgacct-pXa - backs up a p*a account for transfer.&lt;br /&gt;proftpd128 - Installs proftpd-1.2.8.&lt;br /&gt;ptycheck - Fixes permissoins on /dev/ptmx.&lt;br /&gt;pwck -Verifies the integrity of system authentication information.&lt;br /&gt;quickkernel - Updates your kernel.&lt;br /&gt;quicksecure - Quickly kill useless services.&lt;br /&gt;rebuildcpanelsslcrt - Rebuilds the cPanel SSL Certificate.&lt;br /&gt;rebuildcpusers - Rebuilds /var/cpanel/users.&lt;br /&gt;rebuildetcpasswd - Rebuilds /etc/passwd.&lt;br /&gt;rebuildeximbsd - Rebuilds exim on FreeBSD.&lt;br /&gt;rebuildhttpdconffromproftpd - Rebuild httpd.conf from the proftpd.conf file.&lt;br /&gt;rebuildinterchangecfg - Used after moving a domain with Interchange to the server.&lt;br /&gt;rebuildnamedconf - Restore named.conf from files in /var/named.&lt;br /&gt;rebuildproftpd - Restore proftpd.conf from httpd.conf.&lt;br /&gt;reinstallmailman - Reinstalls mailman.&lt;br /&gt;relocatevartousr - Relocates files from /var to /usr in case of disk space issues.&lt;br /&gt;remdefssl - Remove default SSL vhost.&lt;br /&gt;reseteximtodefaults - Resets exim’s default settings.&lt;br /&gt;resetimappasswds - Resets all imap passwords.&lt;br /&gt;resetquotas - Change quotas to what they should be .&lt;br /&gt;restartsrv - Restart a service.&lt;br /&gt;restartsrv_apache - Restart apache.&lt;br /&gt;restartsrv_bind - Restart bind.&lt;br /&gt;restartsrv_clamd - Restart clamd.&lt;br /&gt;restartsrv_courier - Restart courier imap.&lt;br /&gt;restartsrv_cppop - Restart cppop.&lt;br /&gt;restartsrv_entropychat - Restart entropy chat.&lt;br /&gt;restartsrv_exim - Restart exim.&lt;br /&gt;restartsrv_eximstats - Restart exim statistics.&lt;br /&gt;restartsrv_ftpserver - Restart your ftp server.&lt;br /&gt;restartsrv_httpd - Restart httpd.&lt;br /&gt;restartsrv_imap - Restart impad.&lt;br /&gt;restartsrv_inetd - Restart inetd.&lt;br /&gt;restartsrv_interchange - Restart Interchange Shopping Cart.&lt;br /&gt;restartsrv_melange - Restart melange chat.&lt;br /&gt;restartsrv_mysql - Restart mysqld.&lt;br /&gt;restartsrv_named - Restart named.&lt;br /&gt;restartsrv_postgres - Restart postgresql.&lt;br /&gt;restartsrv_postgresql - Restart postgresql.&lt;br /&gt;restartsrv_proftpd - Restart proftpd.&lt;br /&gt;restartsrv_pureftpd - Restart pure-ftpd.&lt;br /&gt;restartsrv_spamd - Restart spamd.&lt;br /&gt;restartsrv_sshd - Restart sshd.&lt;br /&gt;restartsrv_syslogd - Restart syslogd.&lt;br /&gt;restartsrv_tomcat - Restart tomcat.&lt;br /&gt;restartsrv_xinetd - Restart xinetd.&lt;br /&gt;restoremail - Restores a user’s mail.&lt;br /&gt;reswhostmgr - Restart whostmgr.&lt;br /&gt;rpmup - Upgrade redhat/mandrake errata/security.&lt;br /&gt;rrdtoolinstall - Installs RRD Tool.&lt;br /&gt;runstatsonce - Runs statistics (should be used from the crontab).&lt;br /&gt;runweblogs - Run analog/webalizer/etc. for a user.&lt;br /&gt;safeperlinstaller - Installs perl safely.&lt;br /&gt;safeup2date - Runs up2date safely.&lt;br /&gt;safeyum - Runs yum safely.&lt;br /&gt;secureit - Remove unnecessary suid binaries.&lt;br /&gt;securemysql - Attempts to secure the MySQL configuration.&lt;br /&gt;securetmp - Adds securetmp to system startup.&lt;br /&gt;setupfp - Install FrontPage 3 on an account.&lt;br /&gt;setupfp4 - Install FrontPage 4 (2000) installer on an account.&lt;br /&gt;setupfp5 - Install FrontPage 5 (2002) installer on an account.&lt;br /&gt;setupfp5.nosueuxec - Install FrontPage 5 (2002) installer on an account when not using suexec.&lt;br /&gt;showexelist - Shows exe processes.&lt;br /&gt;simpleps - Display the process list.&lt;br /&gt;smartcheck - Checks hard drive integrity.&lt;br /&gt;smtpmailgdionly - Enables SMTP Mail Protection.&lt;br /&gt;spamboxdisable - Disables SpamAssassin’s spambox delivery for all accounts.&lt;br /&gt;suspendacct - Suspends an account.&lt;br /&gt;sysup - update cPanel RPMs.&lt;br /&gt;unlimitnamed - Installs the latest version of bind patched to support greater than 512 ips on the server.&lt;br /&gt;unblockip - Unblocks an IP blocked by portsentry.&lt;br /&gt;unsetupfp4 - Removes FrontPage 4 or 5 from an account.&lt;br /&gt;unslavenamedconf - If the user accidentally sets a DNS master as local server, this will repair named.conf after the loop.&lt;br /&gt;unsuspendacct - Unsuspends an account.&lt;br /&gt;upcp - Updates cPanel.&lt;br /&gt;updated - Updates /scripts.&lt;br /&gt;updatefrontpage - Updates FrontPage&lt;br /&gt;updatenow - Updates /scripts NOW.&lt;br /&gt;updatephpconf - Updates PHP configuration files.&lt;br /&gt;whoowns - Finds out who owns a domain.&lt;br /&gt;wwwacct - Creates an account.&lt;br /&gt;xaddonreport - Reports the current addon scripts installed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6081239671048692828?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6081239671048692828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6081239671048692828' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6081239671048692828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6081239671048692828'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/cpanel-scripts-folder-with-explanation.html' title='Cpanel /scripts folder with explanation of every script.'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7026572486996785337</id><published>2009-02-12T23:00:00.001-08:00</published><updated>2009-02-12T23:02:42.887-08:00</updated><title type='text'>Difference b/w Active and Passive Ftp</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_7kkNOFq7H1o/SZUbDOyaK5I/AAAAAAAAAGk/GSdh29jbFjM/s1600-h/PassiveFTPDiagram.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 268px;" src="http://2.bp.blogspot.com/_7kkNOFq7H1o/SZUbDOyaK5I/AAAAAAAAAGk/GSdh29jbFjM/s400/PassiveFTPDiagram.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5302173878621711250" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_7kkNOFq7H1o/SZUa5hsOc5I/AAAAAAAAAGc/QC8utf4Gevk/s1600-h/ActiveFTPDiagram.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 268px;" src="http://4.bp.blogspot.com/_7kkNOFq7H1o/SZUa5hsOc5I/AAAAAAAAAGc/QC8utf4Gevk/s400/ActiveFTPDiagram.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5302173711897359250" /&gt;&lt;/a&gt;&lt;br /&gt;This article will explain the differences between Active and Passive FTP modes. Active mode is used for servers with tight security.&lt;br /&gt;&lt;br /&gt;Security is a major concern with any computer connected to the internet, therefore any computer connected to the internet should be protected by a Firewall. In order to connect to certain services, such as FTP, you have to allow those connections in the Firewall, on both the Client and Server side.&lt;br /&gt;&lt;br /&gt;Although a client's computer may not have a firewall enabled, a server should always have this enabled for maximum security.In order to connect to an FTP server that has a firewall enabled, you have to connect using a specific connection mode in your FTP program.&lt;br /&gt;&lt;br /&gt;There are different connection modes to choose from when connecting to an FTP server, typically either "Active" or "Passive" mode.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Active mode is beneficial to the FTP Server's security, while Passive mode typically requires less configuration changes on the Client's side.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7026572486996785337?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7026572486996785337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7026572486996785337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7026572486996785337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7026572486996785337'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/02/difference-bw-active-and-passive-ftp.html' title='Difference b/w Active and Passive Ftp'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7kkNOFq7H1o/SZUbDOyaK5I/AAAAAAAAAGk/GSdh29jbFjM/s72-c/PassiveFTPDiagram.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6917045471429188826</id><published>2009-01-27T11:35:00.000-08:00</published><updated>2009-01-27T11:47:39.305-08:00</updated><title type='text'>What is Split DNS?</title><content type='html'>Split DNS refers to using separate internal and external DNS views of your domain's network using internal and external name servers. To set up, configure your internal name servers to forward queries they can't resolve to the external name server. Under Berkeley Internet Name Domain (BIND) 4, use the "forwarders" directive. In BIND 8 systems, use the "forwarders" substatement to configure forwarding. Your external DNS records are configured to contain only a small zone file for your domain, listing things such as Web and FTP server addresses and any translated server addresses you want to publish to the world. Your internal servers hold only the DNS records for your internal networks. When internal users look up host names, the query is answered by internal DNS servers, even if the request is forwarded to an external DNS server for resolution. Internet users who look up host names in your domain are answered by external DNS servers that only know about the publicly accessible resources.&lt;br /&gt;------------------------------------------------&lt;br /&gt;&lt;br /&gt;To know more on this topic, please check the below link.&lt;br /&gt;http://www.isaserver.org/tutorials/You_Need_to_Create_a_Split_DNS.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6917045471429188826?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6917045471429188826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6917045471429188826' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6917045471429188826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6917045471429188826'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/what-is-split-dns.html' title='What is Split DNS?'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-2121306655176665424</id><published>2009-01-24T22:28:00.000-08:00</published><updated>2009-01-24T22:34:00.200-08:00</updated><title type='text'>ssh script</title><content type='html'>Before executing this script, you need to know some details,&lt;br /&gt;&lt;br /&gt;What Is Expect?&lt;br /&gt;&lt;br /&gt;Expect is a UNIX automation and testing tool, written by Don Libes as an extension to the Tcl scripting language, for interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, ssh, and others. It uses UNIX pseudo terminals to wrap up sub-processes transparently, allowing the automation of arbitrary applications that are accessed over a terminal. With Tk, interactive applications can be wrapped in X11 GUIs. Expect has regular expression pattern matching and general program capabilities, allowing simple scripts to intelligently control programs such as telnet, ftp, and ssh, all of which lack a programming language, macros, or any other program mechanism. The result is that Expect scripts provide old tools with significant new power and flexibility.&lt;br /&gt;&lt;br /&gt;The Script&lt;br /&gt;**********&lt;br /&gt;When a server keeps prompting for password at SSH attempts in spite of setting up RSA/DSA keys, this script can be used to overcome that issue. Make sure that the script has 700 permission as it will contain your password in plain text.&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;#! /usr/bin/expect&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;# Edit the following line - $USER@$SERVER&lt;br /&gt;spawn ssh your-useid@your-server-name&lt;br /&gt; &lt;br /&gt;# First time connection will print out some text for&lt;br /&gt;# which one needs to type 'yes' to continue&lt;br /&gt;# Comment these two lines after the first attempt&lt;br /&gt;expect "*Are you sure you want to continue connecting*"&lt;br /&gt;send   "yes\r"&lt;br /&gt; &lt;br /&gt;# Put the password here&lt;br /&gt;expect "*assword*"&lt;br /&gt;send   "YOUR-PASSWORD\r"&lt;br /&gt; &lt;br /&gt;# Start interacting&lt;br /&gt;interact&lt;br /&gt;--------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;The three commands send, expect, and spawn are the building power of Expect. The send command sends strings to a process, the expect command waits for strings from a process, and the spawn command starts a process. &lt;br /&gt;&lt;br /&gt;The spawn Command&lt;br /&gt;&lt;br /&gt;The spawn command starts another program. The first argument of the spawn command is the name of a program to start. The remaining arguments are passed to the program.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks and Regards,&lt;br /&gt;Sylesh H&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-2121306655176665424?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/2121306655176665424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=2121306655176665424' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2121306655176665424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2121306655176665424'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/ssh-script.html' title='ssh script'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6779278139893934016</id><published>2009-01-23T08:18:00.000-08:00</published><updated>2009-01-23T08:19:01.355-08:00</updated><title type='text'>Killing perl processes running.....</title><content type='html'>ps auxww | grep perl | awk '{print $2}' | xargs kill -9&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6779278139893934016?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6779278139893934016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6779278139893934016' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6779278139893934016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6779278139893934016'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/killing-perl-processes-running.html' title='Killing perl processes running.....'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-4612162392480540050</id><published>2009-01-23T08:05:00.001-08:00</published><updated>2009-01-23T08:05:28.600-08:00</updated><title type='text'>Checking bad blocks in Linux</title><content type='html'>First find the hard disk type installed by running the command&lt;br /&gt;fdisk -l&lt;br /&gt;&lt;br /&gt;Run the following command to check the bad blocks in Hdd.&lt;br /&gt;badblocks -v /dev/hda&lt;br /&gt;&lt;br /&gt;It will display if there is any errors while checking the bad blocks..&lt;br /&gt;&lt;br /&gt;Hope this Helps you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-4612162392480540050?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/4612162392480540050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=4612162392480540050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4612162392480540050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4612162392480540050'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/checking-bad-blocks-in-linux.html' title='Checking bad blocks in Linux'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-4451745330037292572</id><published>2009-01-23T07:58:00.000-08:00</published><updated>2009-01-23T08:00:23.340-08:00</updated><title type='text'>Importanf files and its descriptions.</title><content type='html'>* /boot/vmlinuz - the typical location and name of the Linux kernel. In the Slackware distribution, the kernel is located at /vmlinuz.&lt;br /&gt;&lt;br /&gt;* /dev/fd0 - first floppy disk drive&lt;br /&gt;&lt;br /&gt;* /dev/fd0H1440 - driver for the first floppy drive in high density mode. Generally, this is invoked when formatting a floppy drive for a particular density. Slackware comes with drivers that allow for formatting a 3.5" diskette with up to 1.7MB of space. Red Hat and Mandrake do not contain these device driver files by default.&lt;br /&gt;&lt;br /&gt;* /dev/fd1 - second floppy disk drive&lt;br /&gt;&lt;br /&gt;* /dev/hda - first IDE hard drive&lt;br /&gt;&lt;br /&gt;* /dev/hdc - on many machines, the IDE cdrom drive. Most often, there is a symbolic link called /dev/cdrom which is just a link to the true cdrom driver file.&lt;br /&gt;&lt;br /&gt;* /dev/null - used when you want to send output into oblivion&lt;br /&gt;&lt;br /&gt;* /etc/aliases - file containing aliases used by sendmail and other MTAs (mail transport agents). After updating this file, it is necessary to run the newaliases utility for the changes to be passed to sendmail.&lt;br /&gt;&lt;br /&gt;* /etc/bashrc - system-wide default functions and aliases for the bash shell&lt;br /&gt;&lt;br /&gt;* /etc/conf.modules - aliases and options for configurable modules&lt;br /&gt;&lt;br /&gt;* /etc/crontab - shell script to run different commands periodically (hourly, daily, weekly, monthly, etc.)&lt;br /&gt;&lt;br /&gt;* /etc/DIR_COLORS - used to store colors for different file types when using ls command. The dircolors command uses this file when there is not a .dir_colors file in the user's home directory. Used in conjunction with the eval command (see below).&lt;br /&gt;&lt;br /&gt;* /etc/exports - specifies hosts to which file systems can be exported using NFS. Man exports contains information on how to set up this file for remote users.&lt;br /&gt;&lt;br /&gt;* /etc/fstab - contains information on partitions and file systems used by system to mount different partitions and devices on the directory tree&lt;br /&gt;&lt;br /&gt;* /etc/HOSTNAME - stores the name of the host computer&lt;br /&gt;&lt;br /&gt;* /etc/hosts - contains a list of host names and absolute IP addresses.&lt;br /&gt;&lt;br /&gt;* /etc/hosts.allow - hosts allowed (by the tcpd daemon) to access Internet services&lt;br /&gt;&lt;br /&gt;* /etc/hosts.deny - hosts forbidden (by the tcpd daemon) to access Internet services&lt;br /&gt;&lt;br /&gt;* /etc/group - similar to /etc/passwd but for groups&lt;br /&gt;&lt;br /&gt;* /etc/inetd.conf - configures the inetd daemon to tell it what TCP/IP services to provide (which daemons to load at boot time). A good start to securing a Linux box is to turn off these services unless they are necessary.&lt;br /&gt;&lt;br /&gt;* /etc/inittab - runs different programs and processes on startup. This is typically the program which is responsible for, among other things, setting the default runlevel, running the rc.sysinit script contained in /etc/rc.d, setting up virtual login terminals, bringing down the system in an orderly fashion in response to [Ctrl][Alt][Del], running the rc script in /etc/rc.d, and running xdm for a graphical login prompt (only if the default runlevel is set for a graphical login).&lt;br /&gt;&lt;br /&gt;* /etc/issue - pre-login message. This is often overwitten by the /etc/rc.d/rc.S script (in Slackware) or by the /etc/rc.d/rc.local script (in Mandrake and Red Hat, and perhaps other rpm-based distributions). The relevant lines should be commented out (or changed) in these scripts if a custom pre-login message is desired.&lt;br /&gt;&lt;br /&gt;* /etc/lilo.conf - configuration file for lilo boot loader&lt;br /&gt;&lt;br /&gt;* /etc/motd - message of the day file, printed immediately after login. This is often overwritten by /etc/rc.d/rc.S (Slackware) or /etc/rc.d/rc.local (Mandrake/Red Hat) on startup. See the remarks in connection with /etc/issue.&lt;br /&gt;&lt;br /&gt;* /etc/mtab - shows currently mounted devices and partitions and their status&lt;br /&gt;&lt;br /&gt;* /etc/passwd - contains passwords and other information concerning users who are registered to use the system. For obvious security reasons, this is readable only by root. It can be modified by root directly, but it is preferable to use a configuration utility such as passwd to make the changes. A corrupt /etc/passwd file can easily render a Linux box unusable.&lt;br /&gt;&lt;br /&gt;* /etc/printcap - shows the setup of printers&lt;br /&gt;&lt;br /&gt;* /etc/profile - sets system-wide defaults for bash shell. It is this file in Slackware that sets up the DIR_COLORS environment variable for the color ls command. Also sets up other system-wide environment variables.&lt;br /&gt;&lt;br /&gt;* /etc/resolv.conf - contains a list of domain name servers used by the local machine&lt;br /&gt;&lt;br /&gt;* /etc/securetty - contains a list of terminals on which root can login. For security reasons, this should not include dialup terminals.&lt;br /&gt;&lt;br /&gt;* /etc/termcap - ASCII database defining the capabilities and characteristics of different consoles, terminals, and printers&lt;br /&gt;&lt;br /&gt;* /etc/X11/XF86Config - X configuration file. The location in Slackware is /etc/XF86Config.&lt;br /&gt;&lt;br /&gt;* /proc/cpuinfo - cpu information&lt;br /&gt;&lt;br /&gt;* /proc/filesystems - prints filesystems currently in use&lt;br /&gt;&lt;br /&gt;* /proc/interrupts - prints interrupts currently in use&lt;br /&gt;&lt;br /&gt;* /proc/ioports - contains a list of the i/o addresses used by various devices connected to the computer&lt;br /&gt;&lt;br /&gt;* /proc/kcore - The command ls -l /proc/kcore will give the amount of RAM on the computer. It's also possible to use the free command to get the same information (and more).&lt;br /&gt;&lt;br /&gt;* /proc/version - prints Linux version and other info&lt;br /&gt;&lt;br /&gt;* /var/log/messages - used by syslog daemon to store kernel boot-time messages&lt;br /&gt;&lt;br /&gt;* /var/log/lastlog - used by system to store information about last boot&lt;br /&gt;&lt;br /&gt;* /var/log/wtmp - contains binary data indicating login times and duration for each user on system.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-4451745330037292572?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/4451745330037292572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=4451745330037292572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4451745330037292572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/4451745330037292572'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/importanf-files-and-its-description.html' title='Importanf files and its descriptions.'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-2822425681468532666</id><published>2009-01-20T01:20:00.000-08:00</published><updated>2009-01-20T01:21:53.729-08:00</updated><title type='text'>How To Install CPANEL on your VPS</title><content type='html'>Ok. Few Steps to setup your VPS-CPANEL:&lt;br /&gt;&lt;br /&gt;1 - Login to your VZMC and get inside your server&lt;br /&gt;2 - Create a new VPS with the Sample Ve Config call vps.cpanel&lt;br /&gt;3 - Select the ips you want to use in that VPS and the dns servers.&lt;br /&gt;4 - Select RedHat Enterprise Template (not minimal)&lt;br /&gt;5 - Dont select any addon.You dont need it for cpanel.&lt;br /&gt;6 - Select the Space / Memory / CPU . All the normal stuff of your normal VPS. Put Start on boot and the rest of the normal stuff. Rememeber to use unlimited VPs.&lt;br /&gt;7 - Go to your Ev1 Member section, open a ticket with your IP / and root password and request ev1 to get your VPS register in up2date. CHECK IT IF IT IS WELL CONFIGURE!! JUST IN CASE.&lt;br /&gt;8 - Go in ssh and do the following steps:&lt;br /&gt;mkdir /home/cpins&lt;br /&gt;cd /home/cpins&lt;br /&gt;wget http://layer1.cpanel.net/latest&lt;br /&gt;sh latest&lt;br /&gt;This should install cpanel without asking you any questions.&lt;br /&gt;&lt;br /&gt;If you have any problems you should check: http://www.cpanel.net/install.html&lt;br /&gt;&lt;br /&gt;9 - Login to : https://xxx.xxx.xxx.xxx:2087 and setup your server.&lt;br /&gt;If you never setup a cpanel server, you can find some usefull information here: http://www.cpanel.net/docs.htm or search ev1 forum or ask me. I will be happy to help.&lt;br /&gt;&lt;br /&gt;Well. Hopefully for some of you was usefull and will give you something else to try/offer in your VPS server.&lt;br /&gt;&lt;br /&gt;Btw, it needs atleast 128 MB for cpanel to work.&lt;br /&gt;&lt;br /&gt;If you have any problems with the guide let me know.&lt;br /&gt;&lt;br /&gt;carlos&lt;br /&gt;&lt;br /&gt;ps: i talk to some sw-soft people and they recomend to enable second-level quota (QUOTAUGIDLIMIT), i didnt try it myself. But i will let everyone when i try it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-2822425681468532666?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/2822425681468532666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=2822425681468532666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2822425681468532666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2822425681468532666'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/how-to-install-cpanel-on-your-vps.html' title='How To Install CPANEL on your VPS'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7688584254415528688</id><published>2009-01-20T00:39:00.000-08:00</published><updated>2009-01-20T00:48:44.539-08:00</updated><title type='text'>Filesystem attributes.</title><content type='html'>As a Linux administrator, you may be called upon to set up a control system for file access. You probably already know how to set read, write, and execute permissions on files, and you will need to make extensive use of that knowledge. But, sometimes, you'll need more than just these permissions settings to get the job done. That's where filesystem attributes will come in handy. You can set different attributes on files in order to gain more control over how they are accessed.&lt;br /&gt;&lt;br /&gt;There are two slight catches, though. You can only set file attributes on machines with hard drives that are formatted with either the ext2 or ext3 filesystems. That's not a problem for machines that are running a Red Hat-type operating system, since ext3 is your only choice with them. But, if you're setting up a machine with, say, Ubuntu Server, you'll have other filesystems to choose from. Just be sure to choose ext3 if you want to set file attributes.&lt;br /&gt;&lt;br /&gt;Also, if you're accessing files on another computer via NFS, the attributes will still be in effect, but you won't be able to view or change the attributes.&lt;br /&gt;&lt;br /&gt;To view file attributes, you'd use the lsattr command. Entering just the command by itself will show a list of all files in the current directory.&lt;br /&gt;&lt;br /&gt;[sylesh@centos5 ~]$ lsattr&lt;br /&gt;------------- ./mytext.txt&lt;br /&gt;------------- ./Duron_backup&lt;br /&gt;------------- ./iptables-L.txt&lt;br /&gt;------------- ./New_error.txt&lt;br /&gt;------------- ./Desktop&lt;br /&gt;------------- ./moodle-2007-8-25&lt;br /&gt;------------- ./test_dir&lt;br /&gt;------------- ./BOINC&lt;br /&gt;------------- ./ts2_client_rc2_2032.tar.bz2&lt;br /&gt;------------- ./OOo_2.3.0_LinuxIntel_install_wJRE_en-US.tar.gz&lt;br /&gt;------------- ./ifconfig_output.txt&lt;br /&gt;------------- ./dmesg&lt;br /&gt;------------- ./BOINC.tar.bz2&lt;br /&gt;------------- ./ts2_client_rc2_2032&lt;br /&gt;------------- ./tls_handshake_error.txt&lt;br /&gt;[sylesh@centos5 ~]$ lsattr mytext.txt&lt;br /&gt;------------- mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$&lt;br /&gt;[sylesh@centos5 ~]$ chattr +A mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$ lsattr mytext.txt&lt;br /&gt;s-S----A----- mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$&lt;br /&gt;&lt;br /&gt;Of course, you'll seldom want to use the "A" attribute. If you need to turn off atime updates, you're better off mounting the filesystem with the "noatime" parameter, instead.&lt;br /&gt;&lt;br /&gt;So far, we've performed all attribute changes with only normal user privileges, and on the user's own files. There are still two other attributes that can only be set with root privileges. Even if the file belongs to you, you'll receive an error if you try to change them with only your normal user privileges.&lt;br /&gt;&lt;br /&gt;[sylesh@centos5 ~]$ chattr +a mytext.txt&lt;br /&gt;chattr: Operation not permitted while setting flags on mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$&lt;br /&gt;&lt;br /&gt;The "a" attribute will allow a file to be opened only in append mode. This will allow you to add more text or data to a file, but will not allow you to overwrite it.&lt;br /&gt;&lt;br /&gt;[sylesh@centos5 ~]$ sudo chattr +a mytext.txt&lt;br /&gt;Password:&lt;br /&gt;[sylesh@centos5 ~]$ lsattr mytext.txt&lt;br /&gt;s-S--a-A----- mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$ echo "This is a test of the a attribute." &gt; mytext.txt&lt;br /&gt;bash: mytext.txt: Operation not permitted&lt;br /&gt;[sylesh@centos5 ~]$ echo "This is a test of the a attribute." &gt;&gt; mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$&lt;br /&gt;&lt;br /&gt;The final attribute we'll cover, which also requires root privileges, is the "i" attribute. This make a file immutable. In other words, it can't be changed, renamed, or deleted. And, no links can be created to it.&lt;br /&gt;&lt;br /&gt;[sylesh@centos5 ~]$ sudo chattr +i mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$ lsattr mytext.txt&lt;br /&gt;s-S-ia-A----- mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$ rm mytext.txt&lt;br /&gt;rm: remove write-protected regular file `mytext.txt'? y&lt;br /&gt;rm: cannot remove `mytext.txt': Operation not permitted&lt;br /&gt;[sylesh@centos5 ~]$&lt;br /&gt;&lt;br /&gt;Finally, if you need to add or delete more than one attribute, you can combine the operations into one single command.&lt;br /&gt;&lt;br /&gt;[sylesh@centos5 ~]$ sudo chattr -AaisS mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$ lsattr mytext.txt&lt;br /&gt;------------- mytext.txt&lt;br /&gt;[sylesh@centos5 ~]$&lt;br /&gt;&lt;br /&gt;There are a few other attributes that we haven't covered. But they either have operational bugs, or they're attributes that are set by the system, and not by the user.&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;For more information, enter "man chattr" at the command-line. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sylesh&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-7688584254415528688?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/7688584254415528688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=7688584254415528688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7688584254415528688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/7688584254415528688'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/filesystem-attributes.html' title='Filesystem attributes.'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-3443375025748749112</id><published>2009-01-19T00:43:00.001-08:00</published><updated>2009-01-19T00:43:49.260-08:00</updated><title type='text'>What is a name server ?</title><content type='html'>&lt;span style="font-family:Verdana;font-size:85%;"&gt;A &lt;b&gt;Name Server&lt;/b&gt; keeps information for the translation of computer names to IP addresses (even for reverse translations). The name server takes care of a certain part from the space of names of all computers. This part is called the zone (at minimum it takes care of zone 0.0.127.in-addr.arpa). A domain or its part creates the zone. The name server can with the help of an NS type record (in its configuration) delegate administration of a subdomain to a subordinate name server. The name server is a program that performs the translation at the request of a resolver or another name server. In UNIX, the name server is materialized by the named program. Also the name BIND (Berkeley Internet Name Domain) is used for this name server.&lt;br /&gt;&lt;br /&gt;Types of name servers differ according to the way in which they save data:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&gt; Primary name server/primary master&lt;/b&gt; is the main data source for the zone. It is the authoritative server for the zone. This server acquires data about its zone from databases saved on a local disk. Names of these types of servers depend on the version of BIND they use. While only the primary name server was used for version 4.x, a primary name  master is used for version 8. The administrator manually creates databases for this server. The primary server must be published as an authoritative name server for the domain in the SOA resource record, while the primary master server does not need to be published. There is only one of this type of server for each zone.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&gt; Master name server&lt;/b&gt; is an authoritative server for the zone. The master server is always published as an authoritative server for the domain in NS records. The master sever is a source of data of a zone for the subordinate servers (slave/secondary  servers). There can be several master servers. This type of server is used for Bind version 8 and later.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&gt; Secondary name server/slave name server&lt;/b&gt; acquires data about the zone by copying the data from the primary name server (respectively from the master server) at regular time intervals. It makes no sense to edit these databases on the secondary name servers, although they are saved on the local server disk because they will be rewritten during further copying. This type of name server is also an authority for its zones, i.e., its data for the particular zone is considered irrevocable (authoritative). The name of this type of server depends again on the version of BIND it uses. For version 4, only the secondary name was used, the term slave server was used for a completely different type of server. In version 8 you can come across both names.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&gt; Caching-only name server&lt;/b&gt; is neither a primary nor secondary name server (it is not an authority) for any zone. However, it uses the general characteristics of name servers, i.e., it saves data that comes through its cache. This data is called  nonauthoritative. Each server is a caching server, but by the words caching, we understand that it is neither a primary nor secondary name server for any zone. (Of course, even a caching-only server is a primary name server for zone 0.0.127.in-addr.arpa, but that does not count).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&gt; Root name server&lt;/b&gt; is an authoritative name server for the root domain (for the dot). Each root name server is a primary server, which differentiates it from other name servers.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&gt; Slave name server&lt;/b&gt; (in BIND version 4 terminology) transmits questions for a translation to other name servers; it does not perform any iteration itself.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&gt; Stealth name server&lt;/b&gt; is a secret server. This type of name server is not published anywhere. It is only known to the servers that have its IP address statically listed in their configuration. It is an authoritative server. It acquires the data for the zone with  the help of a zone transfer. It can be the main server for the zone. Stealth servers can be used as a local backup if the local servers are unavailable.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-3443375025748749112?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/3443375025748749112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=3443375025748749112' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3443375025748749112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/3443375025748749112'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/what-is-name-server.html' title='What is a name server ?'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-1310023928890513960</id><published>2009-01-15T01:07:00.000-08:00</published><updated>2009-01-15T01:13:03.103-08:00</updated><title type='text'>Nagios in control.</title><content type='html'>&lt;h1 style="font-family: arial;" class="firstHeading"&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;/h1&gt;&lt;h1 class="firstHeading"&gt;Nagios.&lt;br /&gt;&lt;/h1&gt;&lt;h1 class="firstHeading"&gt;&lt;br /&gt;&lt;/h1&gt;          &lt;h3 id="siteSub"&gt;Nagios is a popular open source computer system and network monitoring application software. It watches hosts and services, alerting users when things go wrong and again when they get better.&lt;br /&gt;&lt;/h3&gt;&lt;h3 id="siteSub"&gt;Adding a new server.&lt;br /&gt;&lt;/h3&gt;                      &lt;!-- start content --&gt;      &lt;p&gt;&lt;b&gt;Nagios Administration&lt;/b&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;b&gt;This will help you in adding a new server to Nagios&lt;/b&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;1. Introduction&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;2. Adding Contacts&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;3. Adding Hosts&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;4. Adding Host Groups&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;5. Adding Services&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;6. Scheduling Host/Service Downtime&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;7. Acknowledging a host/services&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;8. Authentication Setup&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;In NAGIOS SERVER&lt;/b&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;hr /&gt; &lt;hr /&gt; &lt;p&gt;&lt;i&gt;&lt;b&gt;contacts.cfg&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;Defines who gets notifications about problems with hosts and services. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;pre&gt;define contact{&lt;br /&gt;     contact_name                    sylesh&lt;br /&gt;     alias                           syslogs&lt;br /&gt;     service_notification_period     none ; Notification period&lt;br /&gt;     host_notification_period        24x7   ; Notification period&lt;br /&gt;     service_notification_options    c,r   ; Notification Options&lt;br /&gt;     host_notification_options       d,r     ; Notification Options&lt;br /&gt;     service_notification_commands   notify-by-email  ; Notification cmd&lt;br /&gt;     service_notification_options n                              ; Notification cmd&lt;br /&gt;     host_notification_commands      host-notify-by-email&lt;br /&gt;     email                           syleshh@gmail.com&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;hr /&gt; &lt;hr /&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;contactgroups.cfg&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Add the user to the appropriate department/server group he/she needs to be a member of &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;pre&gt;define contactgroup{&lt;br /&gt;     contactgroup_name       testgroup   ; Group Name&lt;br /&gt;     alias                   mycutelife   ; Alias for group&lt;br /&gt;     members                 testuser  ; List of members. This user has the privilege to view the status of the&lt;br /&gt;servers which is listed in the group&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;hr /&gt; &lt;hr /&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;i&gt;&lt;b&gt;hostgroups.cfg&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;This allows you to create groups to organise the hosts &lt;/p&gt; &lt;pre&gt;define hostgroup{&lt;br /&gt;     hostgroup_name  testhostgroup&lt;br /&gt;     alias           syslogs&lt;br /&gt;     contact_groups  testgroup&lt;br /&gt;     members server1.hostname.com,server2.hostname.com,server3.hostname.com,server4.hostname.com&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;hr /&gt; &lt;hr /&gt; &lt;p&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;hosts.cfg&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;This contains all the devices you want nagios to check &lt;/p&gt; &lt;pre&gt;#############First Server#############&lt;br /&gt;define host{&lt;br /&gt;     use                     generic-host            ; Name of host template to use&lt;br /&gt;     host_name               server1.hostname.com&lt;br /&gt;     alias                   server1&lt;br /&gt;     address                 192.168.1.1&lt;br /&gt;     check_command           check-host-alive&lt;br /&gt;     max_check_attempts      10&lt;br /&gt;     notification_interval   120&lt;br /&gt;     notification_period     24x7&lt;br /&gt;     notification_options    d,u,r&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#############Second Server#############&lt;br /&gt;define host{&lt;br /&gt;     use                     generic-host            ; Name of host template to use&lt;br /&gt;     host_name               server2.hostname.com&lt;br /&gt;     alias                   server2&lt;br /&gt;     address                 192.168.1.2&lt;br /&gt;     check_command           check-host-alive&lt;br /&gt;     max_check_attempts      10&lt;br /&gt;     notification_interval   120&lt;br /&gt;     notification_period     24x7&lt;br /&gt;     notification_options    d,u,r&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;hr /&gt; &lt;hr /&gt; &lt;p&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;services.cfg&lt;/b&gt;&lt;/i&gt; &lt;/p&gt;&lt;p&gt;If we give host_name (host_name test.test.com) in place of hostgroup_name, we have to add each service entries to be monitored for each server. But if we give hostgroup_name and all hosts or servers are defined in the file hostgroups.cfg, we need only one entry for each service for all servers. &lt;/p&gt; &lt;pre&gt;#########We can define the services to monitor#############&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########Apache#########&lt;br /&gt;define service{&lt;br /&gt;     use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             Apache status&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           3&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_http&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########MTA#########&lt;br /&gt;define service{&lt;br /&gt;     use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             MTA status&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           3&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_smtp&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########QMAIL Queue#########&lt;br /&gt;define service{&lt;br /&gt;use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             QMAIL-Q&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_qmailq&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########Exim Queue#########&lt;br /&gt;define service{&lt;br /&gt;      &lt;br /&gt;use                             generic-service         ; Name of service template to use&lt;br /&gt;    hostgroup_name                  testhostgroup&lt;br /&gt;    service_description             EXIM_QUEUE&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_eximmailqueue&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;pre&gt;#########FTP#########&lt;br /&gt;define service{&lt;br /&gt;     use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             FTP status&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           3&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_ftp&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########Server Load#########&lt;br /&gt;define service{&lt;br /&gt;use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             SYS-LOAD&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_load&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########MYSQL#########&lt;br /&gt;define service{&lt;br /&gt;     use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             MYSQL&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           3&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_mysqlrc&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########DNS#########&lt;br /&gt;define service{&lt;br /&gt;use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             DNS&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_dns&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########SSH#########&lt;br /&gt;define service{&lt;br /&gt;use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             SSH&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_ssh&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;pre&gt;#########POP#########&lt;br /&gt;# Service definition&lt;br /&gt;define service{&lt;br /&gt;     use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             POP3&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_pop&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########DISK_USAGE_SLASH#########&lt;br /&gt;define service{&lt;br /&gt;    use                             generic-service         ; Name of service template to use&lt;br /&gt;    hostgroup_name                  testhostgroup&lt;br /&gt;    service_description             DISK_USAGE_SLASH&lt;br /&gt;    is_volatile                     0&lt;br /&gt;    check_period                    24x7&lt;br /&gt;    max_check_attempts              3&lt;br /&gt;    normal_check_interval           5&lt;br /&gt;    retry_check_interval            1&lt;br /&gt;    contact_groups                  testgroup&lt;br /&gt;    notification_interval           120&lt;br /&gt;    notification_period             24x7&lt;br /&gt;    notification_options            w,u,c,r&lt;br /&gt;    check_command                   check_nrpe!check_diskslash&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########DISK_USAGE_BOOT#########&lt;br /&gt;define service{&lt;br /&gt;     use                             generic-service         ; Name of service template to use&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             DISK_USAGE_BOOT&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_diskboot&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########DISK_USAGE_BACKUP#########&lt;br /&gt;define service{&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             DISK_USAGE_BACKUP&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_diskbackup&lt;br /&gt;     }&lt;br /&gt;#########DISK_USAGE_HOME#########&lt;br /&gt;define service{&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             DISK_USAGE_HOME&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_diskhome&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########DISK_USAGE_TMP#########&lt;br /&gt;define service{&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             DISK_USAGE_TMP&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_disktmp&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########DISK_USAGE_USR#########&lt;br /&gt;define service{&lt;br /&gt;     hostgroup_name                  testhostgroup&lt;br /&gt;     service_description             DISK_USAGE_USR&lt;br /&gt;     is_volatile                     0&lt;br /&gt;     check_period                    24x7&lt;br /&gt;     max_check_attempts              3&lt;br /&gt;     normal_check_interval           5&lt;br /&gt;     retry_check_interval            1&lt;br /&gt;     contact_groups                  testgroup&lt;br /&gt;     notification_interval           120&lt;br /&gt;     notification_period             24x7&lt;br /&gt;     notification_options            w,u,c,r&lt;br /&gt;     check_command                   check_nrpe!check_diskusr&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt; &lt;pre&gt;#########DISK_USAGE_VAR#########&lt;br /&gt;define service{&lt;br /&gt;    hostgroup_name                  testhostgroup&lt;br /&gt;    service_description             DISK_USAGE_VAR&lt;br /&gt;    is_volatile                     0&lt;br /&gt;    check_period                    24x7&lt;br /&gt;    max_check_attempts              3&lt;br /&gt;    normal_check_interval           5&lt;br /&gt;    retry_check_interval            1&lt;br /&gt;    contact_groups                  testgroup&lt;br /&gt;    notification_interval           120&lt;br /&gt;    notification_period             24x7&lt;br /&gt;    notification_options            w,u,c,r&lt;br /&gt;    check_command                   check_nrpe!check_diskvar&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;Sylesh&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-1310023928890513960?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/1310023928890513960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=1310023928890513960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1310023928890513960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/1310023928890513960'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/nagios-in-control.html' title='Nagios in control.'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-2100525344993850011</id><published>2009-01-11T20:54:00.000-08:00</published><updated>2009-01-11T21:07:13.201-08:00</updated><title type='text'>apachectl - Apache HTTP Server Control Interface</title><content type='html'>&lt;div id="page-content"&gt;&lt;div id="preamble"&gt;&lt;h1&gt;apachectl - Apache HTTP Server Control Interface&lt;/h1&gt; &lt;div class="toplang"&gt; &lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;a href="http://httpd.apache.org/docs/2.0/tr/programs/apachectl.html" hreflang="tr" rel="alternate" title="Türkçe"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;       &lt;p&gt;&lt;code&gt;apachectl&lt;/code&gt; is a front end to the Apache HyperText      Transfer Protocol (HTTP) server.  It is designed to help the      administrator control the functioning of the Apache      &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; daemon.&lt;/p&gt;       &lt;p&gt;The &lt;code&gt;apachectl&lt;/code&gt; script can operate in two modes.      First, it can act as a simple front-end to the &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt;      command that simply sets any necessary environment variables and      then invokes &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt;, passing through any command line      arguments.  Second, &lt;code&gt;apachectl&lt;/code&gt; can act as a SysV init      script, taking simple one-word arguments like &lt;code&gt;start&lt;/code&gt;,      &lt;code&gt;restart&lt;/code&gt;, and &lt;code&gt;stop&lt;/code&gt;, and translating them      into appropriate signals to &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt;.&lt;/p&gt;       &lt;p&gt;If your Apache installation uses non-standard paths, you will      need to edit the &lt;code&gt;apachectl&lt;/code&gt; script to set the      appropriate paths to the &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; binary.  You can also      specify any necessary &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; command line arguments.      See the comments in the script for details.&lt;/p&gt;       &lt;p&gt;The &lt;code&gt;apachectl&lt;/code&gt; script returns a 0 exit value on      success, and &gt;0 if an error occurs.  For more details, view      the comments in the script.&lt;/p&gt;&lt;/div&gt; &lt;a name="synopsis" id="synopsis"&gt;Synopsis&lt;/a&gt;&lt;div class="section"&gt;  &lt;p&gt;When acting in pass-through mode, &lt;code&gt;apachectl&lt;/code&gt; can take all the arguments available for the &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; binary.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;strong&gt;apachectl&lt;/strong&gt; [ &lt;var&gt;httpd-argument&lt;/var&gt; ]&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;When acting in SysV init mode, &lt;code&gt;apachectl&lt;/code&gt; takes simple, one-word commands, defined below.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;strong&gt;apachectl&lt;/strong&gt; &lt;var&gt;command&lt;/var&gt;&lt;/code&gt;&lt;/p&gt;  &lt;/div&gt;&lt;div class="top"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/apachectl.html#page-header"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="section"&gt; &lt;h2&gt;&lt;a name="options" id="options"&gt;Options&lt;/a&gt;&lt;/h2&gt;  &lt;p&gt;Only the SysV init-style options are defined here.  Other arguments are defined on the &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; manual page.&lt;/p&gt;  &lt;dl&gt;&lt;dt&gt;&lt;code&gt;start&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;Start the Apache &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; daemon.  Gives an error if it is already running.  This is equivalent to &lt;code&gt;apachectl -k start&lt;/code&gt;.&lt;/dd&gt;&lt;dt&gt;&lt;code&gt;stop&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;Stops the Apache &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; daemon.  This is equivalent to &lt;code&gt;apachectl -k stop&lt;/code&gt;.&lt;/dd&gt;&lt;dt&gt;&lt;code&gt;restart&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;Restarts the Apache &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; daemon.  If the daemon is not running, it is started.  This command automatically checks the configuration files as in &lt;code&gt;configtest&lt;/code&gt; before initiating the restart to make sure the daemon doesn't die.  This is equivalent to &lt;code&gt;apachectl -k restart&lt;/code&gt;.&lt;/dd&gt;&lt;dt&gt;&lt;code&gt;fullstatus&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;Displays a full status report from &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_status.html"&gt;mod_status&lt;/a&gt;&lt;/code&gt;. For this to work, you need to have &lt;code class="module"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_status.html"&gt;mod_status&lt;/a&gt;&lt;/code&gt; enabled on your server and a text-based browser such as &lt;code&gt;lynx&lt;/code&gt; available on your system.  The URL used to access the status report can be set by editing the &lt;code&gt;STATUSURL&lt;/code&gt; variable in the script.&lt;/dd&gt;&lt;dt&gt;&lt;code&gt;status&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;Displays a brief status report.  Similar to the &lt;code&gt;fullstatus&lt;/code&gt; option, except that the list of requests currently being served is omitted.&lt;/dd&gt;&lt;dt&gt;&lt;code&gt;graceful&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;Gracefully restarts the Apache &lt;code class="program"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/programs/httpd.html"&gt;httpd&lt;/a&gt;&lt;/code&gt; daemon.  If the daemon is not running, it is started.  This differs from a normal restart in that currently open connections are not aborted.  A side effect is that old log files will not be closed immediately.  This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them.  This command automatically checks the configuration files as in &lt;code&gt;configtest&lt;/code&gt; before initiating the restart to make sure Apache doesn't die.  This is equivalent to &lt;code&gt;apachectl -k graceful&lt;/code&gt;.&lt;/dd&gt;&lt;dt&gt;&lt;code&gt;configtest&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;Run a configuration file syntax test. It parses the configuration files and either reports &lt;code&gt;Syntax Ok&lt;/code&gt; or detailed information about the particular syntax error.  This is equivalent to &lt;code&gt;apachectl -t&lt;/code&gt;.&lt;/dd&gt;&lt;/dl&gt;  &lt;p&gt;The following additional option is available, but deprecated.&lt;/p&gt;  &lt;dl&gt;&lt;dt&gt;&lt;code&gt;startssl&lt;/code&gt;&lt;/dt&gt;&lt;dd&gt;This is equivalent to &lt;code&gt;apachectl -k start -DSSL&lt;/code&gt;.  We recommend that you use that command explicitly, or you adjust your &lt;code&gt;httpd.conf&lt;/code&gt; to remove the &lt;code class="directive"&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/core.html#ifdefine"&gt;&lt;ifdefine&gt;&lt;/ifdefine&gt;&lt;/a&gt;&lt;/code&gt; section so that SSL will always be available.&lt;/dd&gt;&lt;/dl&gt;Sylesh&lt;br /&gt;&lt;eof startssl="" with="" ssl="" stop="" httpd="" sighup="" fullstatus="" full="" dump="" short="" status="" requires="" lynx="" and="" mod_status="" enabled="" graceful="" restart="" by="" sending="" sigusr1="" or="" start="" if="" not="" running="" configtest="" do="" a="" configuration="" syntax="" test="" help="" this="" screen="" eof="" esac="" done="" exit="" error="2"&gt;&lt;/eof&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-2100525344993850011?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/2100525344993850011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=2100525344993850011' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2100525344993850011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/2100525344993850011'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/apachectl-apache-http-server-control.html' title='apachectl - Apache HTTP Server Control Interface'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-365388081745322999</id><published>2009-01-09T14:44:00.003-08:00</published><updated>2009-01-09T14:44:36.568-08:00</updated><title type='text'>#Difference between ext2 and ext3??</title><content type='html'>#Difference between ext2 and ext3??&lt;br /&gt;&lt;br /&gt;Ext3 is a tiny bit slower than ext2 is, but it holds tremendous advantages.&lt;br /&gt;There is really only one difference between ext2 and ext3, and that is that ext3 uses a journal to prevent filesystem corruption in the case of an unclean shutdown (ie. before the filesystem is synced to disk). That makes ext3 a bit slower than ext2 since all metadata changes are written to the journal, and then flushed to disk, but on the other hand you don't risk having the entire filesystem destroyed at power failure or if an unwitted person turns the computer off uncleanly. You don't have to check the filesystem after an unclean shutdown either.&lt;br /&gt;Ext3 has three levels of journalling. Metadata (ie. internal filesystem structures) are always journalled, so that the filesystem itself is never corrupted. How ordinary data is written to the file system is controllable, though. The default option is the "ordered" mode, which causes file contents to be written to the filesystem before metadata is even committed to the journal. The highest reliable mode is called the "journal" mode, which causes file data to be committed to the journal before it is flushed to its final place, like the metadata. The least reliable mode, but rumoured to be the fastest, is called the "writeback" mode, which makes no promises at all regarding the consistency of file data. Only metadata is output reliably in writeback mode.&lt;br /&gt;&lt;br /&gt;So as for anything else, it's mainly a matter of priority. If you don't want ultimate speed, go with ext3. If you need the highest speed that is theoratically aquirable though, then go with ext2. For that to be effective you'll probably need a really advanced hard drive controller, though.&lt;br /&gt;&lt;br /&gt;It's very easy to convert an ext2 filesystem to ext3. Just run tune2fs -j on the device and then remount it as ext3.&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/2268593637883547236-365388081745322999?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/365388081745322999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=365388081745322999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/365388081745322999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/365388081745322999'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/difference-between-ext2-and-ext3.html' title='#Difference between ext2 and ext3??'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-6007573336997018133</id><published>2009-01-09T14:44:00.001-08:00</published><updated>2009-01-09T14:44:18.563-08:00</updated><title type='text'>#.what is the difference between a soft link and a hard link?</title><content type='html'>#.what is the difference between a soft link and a hard link?&lt;br /&gt;&lt;br /&gt;Unix files consist of two parts: the data part and the filename part.&lt;br /&gt;&lt;br /&gt;The data part is associated with something called an 'inode'. The inode carries the map of where the data is, the file permissions, etc. for the data.&lt;br /&gt;&lt;br /&gt;The filename part carries a name and an associated inode number.&lt;br /&gt;&lt;br /&gt;More than one filename can reference the same inode number; these files are said to be 'hard linked' together.&lt;br /&gt;&lt;br /&gt;On the other hand, there's a special file type whose data part carries a path to another file. Since it is a special file, the OS recognizes the data as a path, and redirects opens, reads, and writes so that, instead of accessing the data within the special file, they access the data in the file named by the data in the special file. This special file is called a 'soft link' or a 'symbolic link' (aka a 'symlink').&lt;br /&gt;more..&lt;br /&gt;&lt;br /&gt;Hard Links :&lt;br /&gt;&lt;br /&gt;1. All Links have same inode number.&lt;br /&gt;&lt;br /&gt;2.ls -l command shows all the links with the link column(Second) shows No. of links.&lt;br /&gt;&lt;br /&gt;3. Links have actual file contents&lt;br /&gt;&lt;br /&gt;4.Removing any link ,just reduces the link count , but doesn’t affect other links.&lt;br /&gt;&lt;br /&gt;Soft Links(Symbolic Links) :&lt;br /&gt;&lt;br /&gt;1.Links have different inode numbers.&lt;br /&gt;&lt;br /&gt;2. ls -l command shows all links with second column value 1 and the link points to original file.&lt;br /&gt;&lt;br /&gt;3. Link has the path for original file and not the contents.&lt;br /&gt;&lt;br /&gt;4.Removing soft link doesn’t affect anything but removing original file ,the link becomes “dangling” link which points to nonexistant file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2268593637883547236-6007573336997018133?l=linuxdeal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxdeal.blogspot.com/feeds/6007573336997018133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2268593637883547236&amp;postID=6007573336997018133' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6007573336997018133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2268593637883547236/posts/default/6007573336997018133'/><link rel='alternate' type='text/html' href='http://linuxdeal.blogspot.com/2009/01/what-is-difference-between-soft-link.html' title='#.what is the difference between a soft link and a hard link?'/><author><name>sylesh</name><uri>http://www.blogger.com/profile/11992184283937751289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2268593637883547236.post-7563665552316039797</id><published>2008-12-18T12:32:00.000-08:00</published><updated>2008-12-18T12:33:16.609-08:00</updated><title type='text'>What is a RBL?</title><content type='html'>HowTo: RBL or DNSBL with Exim - Stop Spam with Exim&lt;br /&gt;This is my micro-howto for how I set up RBL using the Exim Configuration Editor&lt;br /&gt;Are you and your clients tired of getting bombarded with spam email? Stop spam before it gets to your inbox with Exim's RBL,realtime blackhole list, confAiguration options, an invaluable tool for any Cpanel admin.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is a RBL?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Realtime Blackhole List. A list of open mail relays and rogue sites. Subscribers to the RBL reject all mail and/or connection attempts from RBL'd &lt;abbr title="Internet Protocol"&gt;IP&lt;/abbr&gt; addresses, effectively cutting off irresponsible/incompetent domains from the rest of the Internet.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-------------------------------------------&lt;br /&gt; ----------------------&lt;br /&gt;Creating lsearch files&lt;br /&gt;These files are used to manually block spammers, ignore certain domains or incoming hosts.&lt;br /&gt;*****************&lt;br /&gt;&lt;b&gt;Create three text files in the /etc directory:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;/etc/rblblacklist&lt;br /&gt;/etc/rblbypass&lt;br /&gt;/etc/rblwhitelist&lt;br /&gt;&lt;br /&gt;touch /etc/rblblacklist; touch /etc/rblbypass; touch /etc/rblwhitelist&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Examples with sample data:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;/etc/rblblacklist&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Is a manual blacklist, it rejects specific spammer hosts BEFORE they can send more email to your server:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;domain1.com&lt;br /&gt;domain2.com&lt;br /&gt;domain3.com&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;/etc/rblbypass&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Bypasses RBL email testing for specific destination (local) domains that don't want RBL filtering or prefer SpamAssassin tagging:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;domain1.com&lt;br /&gt;domain2.com&lt;br /&gt;domain3.com&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;/etc/rblwhitelist&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Blocks RBL email testing for listed incoming hosts, (wildcards allowed), in case an important client's mailserver is listed on an RBL you use, also automatically excludes relayhosts:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;mail.domain1.com&lt;br /&gt;*.domain2.com&lt;br /&gt;*.domain3.com&lt;br /&gt;&lt;br /&gt;-------------------------------&lt;br /&gt;EXIM CONFIGURATION EDITOR&lt;br /&gt;-------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; If you use the &lt;abbr title="Web Host Manager"&gt;WHM&lt;/abbr&gt;-based Exim Configuration Editor, all of your modifications will be reproduced after each update. If you edit exim.conf directly, cPanel updates MAY overwrite your changes! Because of this, the following changes should be entered using the Exim Configuration Editor.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; ------------------------&lt;br /&gt;&lt;b&gt;Setting up lsearch files&lt;/b&gt;&lt;br /&gt;*******************&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; At the top of the editor, in the window below:&lt;br /&gt;#!!# cPanel Exim 4 Config&lt;br /&gt; Enter these lines:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;domainlist rbl_blacklist = lsearch;/etc/rblblacklist&lt;br /&gt;domainlist rbl_bypass = lsearch;/etc/rblbypass&lt;br /&gt;hostlist rbl_whitelist = lsearch;/etc/relayhosts : partial-lsearch;/etc/rblwhitelist&lt;br /&gt;&lt;br /&gt;&lt
