<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>linuxbuddies.com &#187; server tweak</title>
	<atom:link href="http://linuxbuddies.com/category/server-tweak/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxbuddies.com</link>
	<description>For linux documentations.</description>
	<lastBuildDate>Fri, 11 Sep 2009 10:11:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Prevent image hotlinking</title>
		<link>http://linuxbuddies.com/2009/01/20/prevent-image-hotlinking/</link>
		<comments>http://linuxbuddies.com/2009/01/20/prevent-image-hotlinking/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 19:18:26 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[hotlinkingm preventing image theft]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=313</guid>
		<description><![CDATA[Hotlinking is the use of a linked object, often an image, from one site into a web page belonging to a second site. The second site is said to have an inline link to the site where the object is located.
It is always recommended to enable hotlinking of images, else ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-314" title="hotlinking" src="http://linuxbuddies.com/wp-content/uploads/2009/01/hotlinking-150x150.jpg" alt="hotlinking" width="150" height="150" />Hotlinking is the use of a linked object, often an image, from one site into a web page belonging to a second site. The second site is said to have an inline link to the site where the object is located.<br />
It is always recommended to enable hotlinking of images, else others use just links to your site to load their web-pages, thereby stealing your bandwidth. Do you want that to happen?</p>
<p>If not, copy-paste the below code to your websites .htaccess file.</p>
<p style="padding-left: 30px;">RewriteCond %{HTTP_REFERER} !^$<br />
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]<br />
RewriteRule ^.*\.(bmp|tif|gif|jpg|jpeg|jpe|png)$ &#8211; [F]</p>
<p style="padding-left: 30px;">
<p style="padding-left: 30px;">Haii.. Linux buddy,, you now. safe&#8230;.  :D</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2009/01/20/prevent-image-hotlinking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>kernel compilation</title>
		<link>http://linuxbuddies.com/2009/01/20/kernel-compilation/</link>
		<comments>http://linuxbuddies.com/2009/01/20/kernel-compilation/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 19:10:44 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[kernel compilation]]></category>
		<category><![CDATA[updating]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=307</guid>
		<description><![CDATA[Kernel 
 It makes sure that all processes in the system works fine
Rebuilding

It is done to optimize the kernel to suit our requirements as well as make it more secure from internet attacks
 Steps

1. Determining the current hardware 
 This is required during configuration process to enable hardwares that our new kernel has to support.
Commands ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-309" title="kernel" src="http://linuxbuddies.com/wp-content/uploads/2009/01/kernel-150x150.gif" alt="kernel" width="150" height="150" /><strong>Kernel </strong></p>
<p><strong><span style="font-weight: normal;"> It makes sure that all processes in the system works fine</span></strong></p>
<p><strong><span style="font-weight: normal;"><span>Rebuilding</span><br />
</span></strong></p>
<p><strong><span style="font-weight: normal;">It is done to optimize the kernel to suit our requirements as well as make it more secure from internet attacks</span></strong></p>
<p><span><strong> Steps</strong></span></p>
<p><span><strong></strong></span><br />
<span>1. Determining the current hardware </span><br />
 This is required during configuration process to enable hardwares that our new kernel has to support.<br />
Commands used for the same are:</p>
<p> </p>
<p> </p>
<div class="codetitle" style="padding-left: 30px; "><strong><br />
</strong></div>
<div class="codecontent" style="padding-left: 30px; ">/sbin/lspci </div>
<div class="codecontent" style="padding-left: 30px; ">cat /proc/cpuinfo</div>
<div class="codecontent" style="padding-left: 30px; "></div>
<p><span>2. Download the Source</span><br />
latest sources and its corresponding patches are always available from<a class="postlink" href="http://www.kernel.org/pub/linux/kernel/">http://www.kernel.org/pub/linux/kernel/</a><br />
 As of today (Oct 21, 2008) the latest available source is <a class="postlink" href="http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.2.tar.gz">linux-2.6.27.2.tar.gz</a> and the patch is <a class="postlink" href="http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.27.2.gz">patch-2.6.27.2.gz</a></p>
<p><span>Apply the patches</span></p>
<p>Extract the source using tar -zxvf and patch using gunzip to /usr/src/ folder.</p>
<p>Now cd to linux-2.6.27.2 and apply the patch as shown below:</p>
<div class="codetitle"><strong><br />
</strong></div>
<div class="codecontent" style="padding-left: 30px; "> patch -p1 &lt;../patch-2.6.27.2</div>
<div class="codecontent" style="padding-left: 30px; "></div>
<p><span>4. Configuration</span><br />
 You may copy the current configuration by copying the file .config.</p>
<p> </p>
<p style="padding-left: 30px; ">cp ../linux/.config config.old</p>
<p> Begin the configuration by wiping out all previous configurations and resetting the source directory to a pristine state:</p>
<p> </p>
<div class="codetitle"><strong> </strong></div>
<div class="codecontent" style="padding-left: 30px; ">$ make mrproper</div>
<p> </p>
<p>Run the configuration utility. Either of the below step can be used to run the configuration utility:</p>
<p> </p>
<div class="codetitle" style="padding-left: 30px; "><strong> </strong> make config &#8211; least friendly tool</div>
<div class="codetitle" style="padding-left: 30px; "></div>
<div class="codecontent" style="padding-left: 30px; ">  make oldconfig         (- will read the defaults from the existing .config file. Note that oldconfig will only work within the same major version of the kernel. You cannot, for example, use a 2.4.x .config with the 2.6.x kernel.)</div>
<div class="codecontent" style="padding-left: 30px; "></div>
<div class="codecontent" style="padding-left: 30px; "> make menuconfig      (- Most commonly and recommended method. Gives you a graphical front end to select your options)</div>
<p><span>5. Start Build</span><br />
Clean before the build:</p>
<p> </p>
<div class="codetitle"><strong> </strong></div>
<div class="codecontent" style="padding-left: 30px; "> make clean</div>
<div class="codecontent" style="padding-left: 30px; "></div>
<p> Start the build after cleaning process:</p>
<p> </p>
<div class="codetitle" style="padding-left: 30px; ">make bzImage</div>
<p><span>6. Build and install all the loadable modules</span></p>
<div class="codetitle"><strong> </strong></div>
<div class="codecontent" style="padding-left: 30px; ">  make modules<br />
 make modules_install</div>
<div class="codecontent" style="padding-left: 30px; "></div>
<p><span>7. Copy the required files and generate initrd</span><br />
 Copy the files over for the kernel itself</p>
<div class="codetitle"><strong> </strong></div>
<div class="codecontent" style="padding-left: 30px; "> cp .config /boot/config-2.6.27.2<br />
 cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.27.2<br />
 cp System.map /boot/System.map-2.6.27.2<br />
 mkinitrd /boot/initrd-2.6.27.2.img 2.6.27.2</div>
<p> If you come across an error like: &#8220;/dev/mapper/control: open failed: No such file or directory&#8221; , Run the following commands:</p>
<div class="codetitle"><strong> </strong></div>
<div class="codecontent" style="padding-left: 30px; ">  rm -rf /boot/initrd-2.6.27.2.img<br />
  mkinitrd &#8211;omit-lvm-modules /boot/initrd-2.6.27.2.img 2.6.27.2</div>
<p><span>8. Configure Grub &amp; enable failsafe</span><br />
  Open grub.conf file<br />
  Add the below code to the top of the kernel list:</p>
<p> </p>
<div class="codecontent" style="padding-left: 30px; ">title Red Hat Linux (2.6.27.2)<br />
root (hd0,0)<br />
kernel /vmlinuz-2.6.27.2 ro root=LABEL=/<br />
initrd /initrd-2.6.27.2.img</div>
<div class="codecontent" style="padding-left: 30px; "></div>
<p>  Set the default value to your working kernel. (NOTE: NOT NEW KERNEL)<br />
  Now save and exit from grub.conf file and enter into grub mode by typing &#8220;grub&#8221; from bash prompt<br />
  And set to boot from newly compiled kernel during next reboot:</p>
<p> </p>
<div class="codetitle" style="padding-left: 30px; "><strong> </strong> savedefault &#8211;default=0 &#8211;once</div>
<div class="codetitle" style="padding-left: 30px; "></div>
<p> If your server is up, you are done with your new kernel. Open the file grub.conf and change the value of default to &#8220;0&#8243;</p>
<p><span><span><strong>Congratulations! You are done with your new kernel.</strong></span></span></p>
<p> </p>
<p><strong><span style="font-weight: normal;"><br />
</span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2009/01/20/kernel-compilation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processor type in Linux</title>
		<link>http://linuxbuddies.com/2009/01/20/processor-type-in-linux/</link>
		<comments>http://linuxbuddies.com/2009/01/20/processor-type-in-linux/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 18:59:47 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[server tweak]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[cpuinfo]]></category>
		<category><![CDATA[get information]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Processor]]></category>
		<category><![CDATA[Processor type]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=304</guid>
		<description><![CDATA[







To find the processor type and details
Get the Processor details:


cat /proc/cpuinfo

Find whether the processor is 32 or 64 bit:

 getconf LONG_BIT

Find the architecture:

uname -i



]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-303" title="proccesser" src="http://linuxbuddies.com/wp-content/uploads/2009/01/proccesser-150x150.jpg" alt="proccesser" width="150" height="150" /></p>
<table border="0" cellspacing="0" width="100%">
<tbody>
<tr valign="middle">
<td class="gensmall" align="right"></td>
</tr>
</tbody>
</table>
<div class="postbody"><span><strong>To find the processor type and details</strong></span></p>
<p>Get the Processor details:</p></div>
<div class="postbody"></div>
<div class="postbody"></div>
<div class="postbody" style="padding-left: 30px;">cat /proc/cpuinfo</div>
<div class="postbody" style="padding-left: 30px;"></div>
<div class="postbody">Find whether the processor is 32 or 64 bit:</div>
<div class="postbody"></div>
<div class="postbody" style="padding-left: 30px;"> getconf LONG_BIT</div>
<div class="postbody" style="padding-left: 30px;"></div>
<div class="postbody">Find the architecture:</div>
<div class="postbody"></div>
<div class="postbody" style="padding-left: 30px;">uname -i</div>
<div class="postbody" style="padding-left: 30px;"></div>
<div class="postbody" style="padding-left: 30px;"></div>
<div class="postbody" style="padding-left: 30px;"></div>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2009/01/20/processor-type-in-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enable/ disable ping requests in linux</title>
		<link>http://linuxbuddies.com/2009/01/20/enable-disable-ping-requests-in-linux/</link>
		<comments>http://linuxbuddies.com/2009/01/20/enable-disable-ping-requests-in-linux/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 18:54:11 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ping]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=299</guid>
		<description><![CDATA[ Ping Requests use ICMP protocols. This is enabled/disabled using sysctl values.
To Disable Ping:
 
echo 1 &#62; /proc/sys/net/ipv4/icmp_echo_ignore_all
 
To Enable Ping:
 
echo 0 &#62; /proc/sys/net/ipv4/icmp_echo_ignore_all
]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-298" title="ping" src="http://linuxbuddies.com/wp-content/uploads/2009/01/ping-150x150.gif" alt="ping" width="150" height="150" /> Ping Requests use ICMP protocols. This is enabled/disabled using sysctl values.<br />
To Disable Ping:</p>
<p> </p>
<p style="padding-left: 30px;">echo 1 &gt; /proc/sys/net/ipv4/icmp_echo_ignore_all</p>
<p style="padding-left: 30px;"> </p>
<p>To Enable Ping:</p>
<p> </p>
<p style="padding-left: 30px;">echo 0 &gt; /proc/sys/net/ipv4/icmp_echo_ignore_all</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2009/01/20/enable-disable-ping-requests-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Limiting FTP users to their home directory</title>
		<link>http://linuxbuddies.com/2009/01/16/limiting-ftp-users-to-their-home-directory/</link>
		<comments>http://linuxbuddies.com/2009/01/16/limiting-ftp-users-to-their-home-directory/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 15:22:01 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[FTP]]></category>
		<category><![CDATA[User administration]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[limit ftp user]]></category>
		<category><![CDATA[pro-ftpd]]></category>
		<category><![CDATA[pure-ftpd]]></category>
		<category><![CDATA[vsftpd]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=280</guid>
		<description><![CDATA[ Purpose
Unless the ftp users are limited to their home directories, they will able to access all files &#38; folders on the server .
How to
Below you may see how this can done to 3 of the ftp servers used in common.
Pro-ftpd
vsftpd
pure-ftpd
Pure-ftpd 
vi  /etc/pure-ftpd.conf
And change the following line
ChrootEveryone=YES
pro-ftpd
 vi  /etc/proftpd.conf
DefaultRoot ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-279" title="ftp" src="http://linuxbuddies.com/wp-content/uploads/2009/01/ftp-150x150.gif" alt="ftp" width="150" height="150" /> <strong>Purpose</strong></p>
<p>Unless the ftp users are limited to their home directories, they will able to access all files &amp; folders on the server .</p>
<p><strong>How to</strong></p>
<p>Below you may see how this can done to 3 of the ftp servers used in common.</p>
<p>Pro-ftpd</p>
<p>vsftpd</p>
<p>pure-ftpd</p>
<p><strong>Pure-ftpd </strong></p>
<p style="padding-left: 30px;">vi  /etc/pure-ftpd.conf</p>
<p>And change the following line</p>
<p style="padding-left: 30px;">ChrootEveryone=YES</p>
<p><strong>pro-ftpd</strong></p>
<p style="padding-left: 30px;"><strong> </strong>vi  /etc/proftpd.conf</p>
<p style="padding-left: 30px;">DefaultRoot ~</p>
<p><strong>Vsftpd </strong></p>
<p style="padding-left: 30px;">vi /etc/vsftpd.conf</p>
<div class="codecontent" style="padding-left: 30px;">chroot_local_user=YES</div>
<p style="padding-left: 30px;"><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2009/01/16/limiting-ftp-users-to-their-home-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios installation</title>
		<link>http://linuxbuddies.com/2008/12/27/nagios-installation/</link>
		<comments>http://linuxbuddies.com/2008/12/27/nagios-installation/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 08:22:39 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[nagios configuration]]></category>
		<category><![CDATA[nagios edit]]></category>
		<category><![CDATA[nagios installation]]></category>
		<category><![CDATA[server monitoring]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=226</guid>
		<description><![CDATA[Nagios is the new name for NetSaint, a network/service monitoring tool. It was designed for Linux, but can be compiled and run perfectly well under any UNIX variant as far as I am aware. The monitoring daemon runs intermittent checks on hosts and services you specify.Nagios can send report through ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-227" title="nagios" src="http://linuxbuddies.com/wp-content/uploads/2008/12/nagios-150x150.jpg" alt="nagios" width="150" height="150" />Nagios is the new name for NetSaint, a network/service monitoring tool. It was designed for Linux, but can be compiled and run perfectly well under any UNIX variant as far as I am aware. The monitoring daemon runs intermittent checks on hosts and services you specify.Nagios can send report through sms, email, instant message, etc..</p>
<p> </p>
<p>Please follow the steps to install nagios. </p>
<p> </p>
<p><span>Download nagios from source </span></p>
<blockquote><p><span><br />
wget <a href="http://prdownloads.sourceforge.net/nagios/nagios-2.9.tar.gz?download" target="_blank">http://prdownloads.sourceforge.net/nagios/nagios-2.9.tar.gz?download</a></span></p></blockquote>
<p><span><a href="http://prdownloads.sourceforge.net/nagios/nagios-2.9.tar.gz?download" target="_blank"></a></p>
<p>Unpack the sourc file </span></p>
<blockquote><p><span><br />
tar -xzvf nagios-2.9.tar.gz</span></p></blockquote>
<p><span></p>
<p>create user for nagios</span></p>
<blockquote><p><span><br />
useradd nagios</span></p>
<p><span><br />
</span></p></blockquote>
<p><span> Create Installation Directory</span></p>
<p><span><br />
</span></p>
<blockquote><p><span><br />
mkdir /usr/local/nagios</span></p></blockquote>
<p> </p>
<p class="MsoNormal">Change the owner of the base installtion directory to be the Nagios user and group you added earlier as follows:</p>
<blockquote>
<p class="MsoNormal">
chown nagios.nagios /usr/local/nagios</p></blockquote>
<p class="MsoNormal">
 Create a new command file group whose members include the user your web server is running as and the user Nagios is running<br />
as.</p>
<blockquote>
<p class="MsoNormal">
groupadd nagcmd </p></blockquote>
<blockquote>
<p class="MsoNormal">
<p> Add the users that your web server and Nagios run as to the newly created group</p>
<p>usermod -G nagcmd nagios<br />
usermod -G nagcmd nobody</p></blockquote>
<p class="MsoNormal"> Run the configuration script.</p>
<p class="MsoNormal"> </p>
<blockquote>
<p class="MsoNormal">./configure &#8211;prefix=/usr/local/nagios &#8211;with-cgiurl=/nagios/cgi-bin &#8211;with-htmurl=/nagios/ &#8211;with-nagios-user=nagios &#8211;with-nagios-group=nagios &#8211;with-command-group=nagcmd</p>
</blockquote>
<p class="MsoNormal"> Compile Binaries-</p>
<blockquote>
<p class="MsoNormal">
make all</p></blockquote>
<p class="MsoNormal">
<p> Install the Binaries And HTML Files-</p>
<blockquote>
<p class="MsoNormal">
make install </p></blockquote>
<p class="MsoNormal">
<p>9. Install An Init Script-</p>
<blockquote>
<p class="MsoNormal">
make install-init</p></blockquote>
<p class="MsoNormal">
<p> Download Nagios plugin to /usr/local/nagios  from</p>
<blockquote>
<p class="MsoNormal">
wget <a href="http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.9.tar.gz?modtime=1180952247&amp;big_mirror=0" target="_blank">http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.9.tar.gz?modtime=1180952247&amp;big_mirror=0</a></p></blockquote>
<p class="MsoNormal"><a href="http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.9.tar.gz?modtime=1180952247&amp;big_mirror=0" target="_blank"></a><br />
untar; and cd into the new directory.</p>
<blockquote>
<p class="MsoNormal">
<p> Compile Binaries- make</p></blockquote>
<blockquote>
<p class="MsoNormal">
<p> make install</p></blockquote>
<p class="MsoNormal">
<p> Setup The Web Interface</p>
<p class="MsoNormal">
<p>ADD THE FOLLOWING ENTRIES TO HTTPD.CONF</p>
<p class="MsoNormal">
<p>Configure Aliases and Directory Options For The Web Interface</p>
<blockquote>
<p class="MsoNormal">
<p>ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/<br />
&lt;Directory /usr/local/nagios/sbin/&gt;<br />
AllowOverride AuthConfig<br />
Options ExecCGI<br />
Allow from all<br />
Order allow,deny<br />
&lt;/Directory&gt;</p>
<p>Alias /nagios/ /usr/local/nagios/share/<br />
&lt;Directory /usr/local/nagios/share&gt;<br />
Options None<br />
AllowOverride AuthConfig<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;</p></blockquote>
<p class="MsoNormal">
 Include the file in the Apache configuration file.</p>
<p class="MsoNormal">
<p> Create a user for the web authentication -nagiosadmin<br />
 Provide a password that will be used when nagiosadmin authenticates to the web server.</p>
<blockquote>
<p class="MsoNormal">
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin</p></blockquote>
<p class="MsoNormal">
 Enable Authentication/Authorization Functionality In The CGIs</p>
<p class="MsoNormal"> </p>
<blockquote>
<p class="MsoNormal">
Set use_authentication=0 in cgi.cfg file.</p></blockquote>
<p class="MsoNormal">
<p>Set the default Permissions To CGI Information</p>
<blockquote>
<p class="MsoNormal">
<p>authorized_for_system_information=nagiosadmin<br />
authorized_for_configuration_information=nagiosadmin<br />
authorized_for_system_commands=nagiosadmin<br />
authorized_for_all_services=nagiosadmin<br />
authorized_for_all_hosts=nagiosadmin<br />
authorized_for_all_service_commands=nagiosadmin<br />
authorized_for_all_host_commands=nagiosadmin</p></blockquote>
<p class="MsoNormal">
<p>  Restart The Web Server</p>
<blockquote>
<p class="MsoNormal">
 cd  /user/local/nagios/etc</p></blockquote>
<p class="MsoNormal">
  Create directories hosts and services</p>
<blockquote>
<p class="MsoNormal">
mkdir hosts.<br />
mkdir services.</p></blockquote>
<p class="MsoNormal">  Specify the directories in the nagios.cfg file.</p>
<blockquote>
<p class="MsoNormal">
cfg_dir=/usr/local/nagios/etc/hosts<br />
cfg_dir=/usr/local/nagios/etc/services</p></blockquote>
<p class="MsoNormal">
 In each of these directories we need to create files for each servers we need to monitor.<br />
Each of these files will contain the hostname and ip of the respective servers.<br />
For this we need to make a copy of the HOSTS block in the localhost.cfg file for each servers.<br />
Similarly we need to make a copy of the SERVICES block of the localhost.cfg for each servers<br />
in the services directory.</p>
<p>  We need to specify the emailID where we recieve the alerts in the localhost.cfg file.</p>
<p> Also we need to add all the hostname we are monitoring in the HOSTGROUP of the localhost.cfg file.</p>
<p> Once this is done, we need to start nagios.</p>
<p>We can see the logg details of nagios in the /usr/local/nagios/var/nagios. log file.</p>
<p>This completes the configuration of NAGIOS!!!</p>
<p>SAMPLE CONFIGURATION TO ADD A HOST<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p># Generic host definition template &#8211; This is NOT a real host, just a template!</p>
<p>define host{<br />
        name                            generic-host    ; The name of this host template<br />
        notifications_enabled           1               ; Host notifications are enabled<br />
        event_handler_enabled           1               ; Host event handler is enabled<br />
        flap_detection_enabled          1               ; Flap detection is enabled<br />
        failure_prediction_enabled      1               ; Failure prediction is enabled<br />
        process_perf_data               1               ; Process performance data<br />
        retain_status_information       1               ; Retain status information across program restarts<br />
        retain_nonstatus_information    1               ; Retain non-status information across program restarts<br />
        notification_period             24&#215;7            ; Send host notifications at any time<br />
        register                        0               ; DONT REGISTER THIS DEFINITION &#8211; ITS NOT A REAL HOST, JUST A TEMPLATE!<br />
        }</p>
<p># Linux host definition template &#8211; This is NOT a real host, just a template!</p>
<p>define host{<br />
        name                            swww3.couchsurfing.com  ; The name of this host template<br />
        use                             generic-host    ; This template inherits other values from the generic-host template<br />
        check_period                    24&#215;7            ; By default, Linux hosts are checked round the clock<br />
        max_check_attempts              10              ; Check each Linux host 10 times (max)<br />
        check_command                   check-host-alive ; Default command to check Linux hosts<br />
        notification_period             workhours       ; Linux admins hate to be woken up, so we only notify during the day<br />
                                                        ; Note that the notification_period variable is being overridden from                                                        ; the value that is inherited from the generic-host template!<br />
        notification_interval           120             ; Resend notification every 2 hours<br />
        notification_options            d,u,r           ; Only send notifications for specific host states<br />
        contact_groups                  admins          ; Notifications get sent to the admins by default<br />
        register                        0               ; DONT REGISTER THIS DEFINITION &#8211; ITS NOT A REAL HOST, JUST A TEMPLATE!<br />
        }</p>
<p># Since this is a simple configuration file, we only monitor one host &#8211; the<br />
# local host (this machine).</p>
<p>define host{<br />
        use                     swww3.couchsurfing.com           ; Name of host template to use<br />
                                                        ; This host definition will inherit all variables that are defined<br />
                                                        ; in (or inherited by) the linux-server host template definition.<br />
        host_name               swww3.couchsurfing.com<br />
        alias                   swww3.couchsurfing.com<br />
        address                 207.210.80.122<br />
}</p>
<p>SAMPLE CONFIGURATION TO ADD SERVICES TO A HOST<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p># Generic service definition template &#8211; This is NOT a real service, just a template!</p>
<p>define service{<br />
        name                            generic-service         ; The &#8216;name&#8217; of this service template<br />
        active_checks_enabled           1                       ; Active service checks are enabled<br />
        passive_checks_enabled          1                       ; Passive service checks are enabled/accepted<br />
        parallelize_check               1                       ; Active service checks should be parallelized (disabling this can lead to major performance problems)<br />
        obsess_over_service             1                       ; We should obsess over this service (if necessary)<br />
        check_freshness                 0                       ; Default is to NOT check service &#8216;freshness&#8217;<br />
        notifications_enabled           1                       ; Service notifications are enabled<br />
        event_handler_enabled           1                       ; Service event handler is enabled<br />
        flap_detection_enabled          1                       ; Flap detection is enabled<br />
        failure_prediction_enabled      1                       ; Failure prediction is enabled<br />
        process_perf_data               1                       ; Process performance data<br />
        retain_status_information       1                       ; Retain status information across program restarts<br />
        retain_nonstatus_information    1                       ; Retain non-status information across program restarts<br />
        is_volatile                     0                       ; The service is not volatile<br />
        register                        0                       ; DONT REGISTER THIS DEFINITION &#8211; ITS NOT A REAL SERVICE, JUST A TEMPLATE!<br />
        }</p>
<p># Local service definition template &#8211; This is NOT a real service, just a template!</p>
<p>define service{<br />
        name                            local-service           ; The name of this service template<br />
        use                             generic-service         ; Inherit default values from the generic-service definition<br />
        check_period                    24&#215;7                    ; The service can be checked at any time of the day<br />
        max_check_attempts              4                       ; Re-check the service up to 4 times in order to determine its final (hard) state<br />
        normal_check_interval           5                       ; Check the service every 5 minutes under normal conditions<br />
        retry_check_interval            1                       ; Re-check the service every minute until a hard state can be determined<br />
        contact_groups                  admins                  ; Notifications get sent out to everyone in the &#8216;admins&#8217; group<br />
        notification_options            w,u,c,r                 ; Send notifications about warning, unknown, critical, and recovery events<br />
        notification_interval           60                      ; Re-notify about service problems every hour<br />
        notification_period             24&#215;7                    ; Notifications can be sent out at any time<br />
        register                        0                       ; DONT REGISTER THIS DEFINITION &#8211; ITS NOT A REAL SERVICE, JUST A TEMPLATE!<br />
        }</p>
<p># Define a service to &#8220;ping&#8221; the local machine</p>
<p>define service{<br />
        use                             local-service         ; Name of service template to use<br />
        host_name                       www4.couchsurfing.com<br />
        service_description             PING<br />
        check_command                   check_ping!100.0,20%!500.0,60%<br />
        }</p>
<p># Define a service to check the disk space of the root partition<br />
# on the local machine.  Warning if &lt; 20% free, critical if<br />
# &lt; 10% free space on partition.</p>
<p>define service{<br />
        use                             local-service         ; Name of service template to use<br />
        host_name                        www4.couchsurfing.com<br />
        service_description             Root Partition<br />
        check_command                   check_local_disk!20%!10%!/<br />
        }</p>
<p># Define a service to check the number of currently logged in<br />
# users on the local machine.  Warning if &gt; 20 users, critical<br />
# if &gt; 50 users.</p>
<p>define service{<br />
        use                             local-service         ; Name of service template to use<br />
        host_name                        www4.couchsurfing.com<br />
        service_description             Current Users<br />
        check_command                   check_local_users!20!50<br />
        }</p>
<p># Define a service to check the number of currently running procs<br />
# on the local machine.  Warning if &gt; 250 processes, critical if<br />
# &gt; 400 users.</p>
<p>define service{<br />
        use                             local-service         ; Name of service template to use<br />
        host_name                        www4.couchsurfing.com<br />
        service_description             Total Processes<br />
        check_command                   check_local_procs!250!400!RSZDT<br />
        }</p>
<p># Define a service to check the load on the local machine.</p>
<p>define service{<br />
        use                             local-service         ; Name of service template to use<br />
        host_name                        www4.couchsurfing.com<br />
        service_description             Current Load<br />
        check_command                   check_local_load!5.0,4.0,3.0!10.0,6.0,4.0<br />
        }</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2008/12/27/nagios-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading kernel</title>
		<link>http://linuxbuddies.com/2008/12/27/upgrading-kernel/</link>
		<comments>http://linuxbuddies.com/2008/12/27/upgrading-kernel/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 08:06:33 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[kernal]]></category>
		<category><![CDATA[linux. install]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=222</guid>
		<description><![CDATA[

Upgrading kernel
Situation
the existing kernel was 2.4 and the required one is 2.6


cd /usr/local/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.1.tar.gz
tar -zxf linux-2.6.20.1.tar.gz
cd linux-2.6.20.1

Now we need to copy the existing   kernel configuration file 


cp /boot/config-2.4.22-1.2199.nptlsmp /usr/local/src/linux-2.6.20.1/.config

Now we need to configure the kernel using this configuration file .. for that use
 


make oldconfig

You can see a lot of new  features for ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-223" title="kernal" src="http://linuxbuddies.com/wp-content/uploads/2008/12/kernal-150x150.jpg" alt="kernal" width="150" height="150" /></p>
<div>
<p class="MsoNormal">Upgrading kernel</p>
<p class="MsoNormal">Situation</p>
<p class="MsoNormal">the existing kernel was 2.4 and the required one is 2.6</p>
<blockquote>
<p class="MsoNormal">
<p>cd /usr/local/src<br />
wget <a href="http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.1.tar.gz" target="_blank">http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.1.tar.gz</a></p>
<p>tar -zxf linux-2.6.20.1.tar.gz</p>
<p>cd linux-2.6.20.1</p></blockquote>
<p class="MsoNormal">
<p>Now we need to copy the existing   kernel configuration file </p>
<blockquote>
<p class="MsoNormal">
<p>cp /boot/config-2.4.22-1.2199.nptlsmp /usr/local/src/linux-2.6.20.1/.config</p></blockquote>
<p class="MsoNormal">
<p>Now we need to configure the kernel using this configuration file .. for that use</p>
<p class="MsoNormal"> </p>
<blockquote>
<p class="MsoNormal">
make oldconfig</p></blockquote>
<p class="MsoNormal">
<p>You can see a lot of new  features for the 2.6 kernel and select the ones we need .<br />
Then to compile and install:</p>
<blockquote>
<p class="MsoNormal">
<p>make bzImage<br />
make modules<br />
make modules_install<br />
make install</p></blockquote>
<p class="MsoNormal">
Once it is installed we need to edit the boot loader (/etc/grub.conf) <span> </span>to load the new kernel . Reboot the server</p>
<div></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2008/12/27/upgrading-kernel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySql Replication</title>
		<link>http://linuxbuddies.com/2008/12/27/mysql-replication/</link>
		<comments>http://linuxbuddies.com/2008/12/27/mysql-replication/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 01:09:11 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mysql replication]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=244</guid>
		<description><![CDATA[Mysql Replication is used to get a mirror copy of master server to slave. All changes made in server is updated on slave. This can be achieved by the following steps. one thing to be notify is the master and salvemay contain the same version of mysql.
  changes in master ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-thumbnail wp-image-245" title="replication" src="http://linuxbuddies.com/wp-content/uploads/2008/12/replication-150x150.png" alt="replication" width="150" height="150" />Mysql Replication is used to get a mirror copy of master server to slave. All changes made in server is updated on slave. This can be achieved by the following steps. one thing to be notify is the master and salvemay contain the same version of mysql.</p>
<p><span> <span style="text-decoration: underline;"><span style="text-decoration: underline;"> </span>changes in master</span> </span></p>
<blockquote><p><span><span>edit /etc/my.cnf<br />
  [mysqld]<br />
  log-bin = mysql-bin<br />
  server-id = 1<br />
  restart the mysql service</span></span></p></blockquote>
<p><span><span><span>enter the following commands in mysql<br />
</span></span></span></p>
<blockquote><p><span><span><span><span>grant all on *.* to user@slaveip identified by &#8216;userpassword&#8217; with grant option;<br />
     grant replication slave on *.* to &#8216;username&#8217;@masterip identified by &#8216;userpassword&#8217;;<br />
     show master status;</span></span></span></span></p></blockquote>
<p><span><span><span><span><span>   <span style="text-decoration: underline;"><strong> </strong></span><span style="text-decoration: underline;"><span style="text-decoration: none;">changes in slave </span></span></span></span></span></span></span></p>
<blockquote><p><span><span><span><span><span><span style="text-decoration: underline;"><span style="text-decoration: none;"><span>vi /etc/my.cnf<br />
[mysqld]<br />
  log-bin = mysql-bin<br />
  server-id = 2<br />
  restart the mysql service </span></span></span></span></span></span></span></span></p></blockquote>
<p><span><span><span><span><span><span style="text-decoration: underline;"><span style="text-decoration: none;"><span><span>enter the following commands in mysql</span></span></span></span></span></span></span></span></span></p>
<blockquote><p><span><span><span><span><span><span style="text-decoration: underline;"><span style="text-decoration: none;"><span><span><span>grant all on *.* to username@localhost identified by &#8216;userpassword&#8217;;<br />
     change master to master_host=&#8217;server ip&#8217;;<br />
     change master to master_user=&#8217;username&#8217;;         <br />
     change master to master_password=&#8217;userpassword&#8217;;               <br />
     change master to master_log_file=&#8217;mysql-bin&#8217;;     <br />
     change master to master_log_pos=561;  (by command show master status;  in master )        </span></span></span></span></span></span></span></span></span></span></p></blockquote>
<p><span><span><span><span><span><span style="text-decoration: underline;"><span style="text-decoration: none;"><span><span><span><span>to update data from master by using the command </span></span></span></span></span></span></span></span></span></span></span></p>
<blockquote><p><span><span><span><span><span><span style="text-decoration: underline;"><span style="text-decoration: none;"><span><span><span><span><span>load data from master;</span></span></span></span></span></span></span></span></span></span></span></span></p></blockquote>
<p><span><span><span><span><span><span style="text-decoration: underline;"><span style="text-decoration: none;"><span><span><span><span><span><br />
</span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><br />
</span></span></p>
<p><span><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2008/12/27/mysql-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server monitoring script!</title>
		<link>http://linuxbuddies.com/2008/12/26/server-monitoring-script/</link>
		<comments>http://linuxbuddies.com/2008/12/26/server-monitoring-script/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 08:31:31 +0000</pubDate>
		<dc:creator>Riyesh</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[server tweak]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell script]]></category>

		<guid isPermaLink="false">http://linuxbuddies.com/?p=235</guid>
		<description><![CDATA[Please do  this script on your own risk, first test this script on test machine. then do it on live server 
 
 
#!/bin/bash
EMAIL=”riyesh@linuxbuddies.com”
SUBJECT=”Alert $(hostname) load average is $L05?
TEMPFILE=”/tmp/$(hostname)”
echo “Load average Crossed allowed limit.” &#62;&#62; $TEMPFILE
echo “Hostname: $(hostname)” &#62;&#62; $TEMPFILE
echo “Local Date &#38; Time : $(date)” &#62;&#62; $TEMPFILE
echo “&#124; Uptime status: &#124;” &#62;&#62; ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-234" title="bash-shell1" src="http://linuxbuddies.com/wp-content/uploads/2008/12/bash-shell1.png" alt="bash-shell1" width="128" height="128" />Please do  this script on your own risk, first test this script on test machine. then do it on live server </p>
<p> </p>
<p> </p>
<p class="MsoNormal">#!/bin/bash<br />
EMAIL=”riyesh@linuxbuddies.com”<br />
SUBJECT=”Alert $(hostname) load average is $L05<span>?</span><br />
TEMPFILE=”/tmp/$(hostname)”<br />
echo “Load average Crossed allowed limit.” &gt;&gt; $TEMPFILE<br />
echo “Hostname: $(hostname)” &gt;&gt; $TEMPFILE<br />
echo “Local Date &amp; Time : $(date)” &gt;&gt; $TEMPFILE<br />
echo “| Uptime status: |” &gt;&gt; $TEMPFILE<br />
echo “——————————————-” &gt;&gt; $TEMPFILE<br />
/usr/bin/uptime &gt;&gt; $TEMPFILE<br />
echo “——————————————-” &gt;&gt; $TEMPFILE<br />
echo “| Top 20 CPU consuming processes: |” &gt;&gt; $TEMPFILE<br />
ps aux | head -1 &gt;&gt; $TEMPFILE<br />
ps aux –no-headers | sort -rn +2 | head -20 &gt;&gt; $TEMPFILE<br />
echo “| Top 10 memory-consuming processes: |” &gt;&gt; $TEMPFILE<br />
ps aux –no-headers| sort -rn +3 | head &gt;&gt; $TEMPFILE<br />
echo “——————————————-” &gt;&gt; $TEMPFILE<br />
echo “| Memory and Swap status: |” &gt;&gt; $TEMPFILE<br />
/usr/bin/free -m &gt;&gt; $TEMPFILE<br />
echo “——————————————-” &gt;&gt; $TEMPFILE<br />
echo “| Active network connection: |” &gt;&gt; $TEMPFILE<br />
echo “——————————————-” &gt;&gt; $TEMPFILE<br />
/bin/netstat -tnup | grep ESTA &gt;&gt; $TEMPFILE<br />
echo “——————————————-” &gt;&gt; $TEMPFILE<br />
echo “| Disk Space information: |” &gt;&gt; $TEMPFILE<br />
echo “——————————————-” &gt;&gt; $TEMPFILE<br />
/bin/df -h &gt;&gt; $TEMPFILE<br />
echo “—————–THE END——————-” &gt;&gt; $TEMPFILE<br />
L05=”$(uptime|awk ‘{print $(NF-2)}’|cut -d. -f1)”<br />
if test $L05 -gt 5<br />
then<br />
mail -s “$SUBJECT” “$EMAIL” &lt; $TEMPFILE<br />
fi<br />
rm -f $TEMPFILE</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxbuddies.com/2008/12/26/server-monitoring-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
