<?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>Tips and Tricks about Servers and Applications</title>
	<atom:link href="http://www.serveridol.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serveridol.com</link>
	<description>Just a bookmark of All my Solved problems</description>
	<lastBuildDate>Thu, 03 May 2012 19:08:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Subversion : Removing uncommitted transactions</title>
		<link>http://www.serveridol.com/2012/05/03/subversion-removing-uncommitted-transactions/</link>
		<comments>http://www.serveridol.com/2012/05/03/subversion-removing-uncommitted-transactions/#comments</comments>
		<pubDate>Thu, 03 May 2012 19:07:20 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1630</guid>
		<description><![CDATA[<p>One of the projects badly affected by the following errors and user requested us to re-load the new repository with latest code they have. After spending some time in net, it&#8217;s is identified that there are lots of uncommitted transaction logs are occurred in svn repository. This cause svn stops to execute any further commits [...]]]></description>
			<content:encoded><![CDATA[<p>One of the projects badly affected by the following errors and user requested us to re-load the new repository with latest code they have. After spending some time in net, it&#8217;s is identified that there are lots of uncommitted transaction logs are occurred in svn repository. This cause svn stops to execute any further commits after that. A quick fix for this problem is to delete all the broken commit from the repository. </p>
<p>This is the error users getting on eclipse  editor while committing changes</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">org.apache.subversion.javahl.ClientException: RA layer request failed<br />
svn: Commit failed (details follow):<br />
svn: Server sent unexpected return value (500 Internal Server Error) in response to PUT request for '/svn/intersight/!svn/wrk/dfbb33ea-17f5-9347-a3f2-3c597d8a7c9a/trunk/WebContent/WEB-INF/lib/jpa-api-2.0-cr-1.jar'<br />
<br />
org.apache.subversion.javahl.ClientException: RA layer request failed<br />
svn: Commit failed (details follow):</div></div>
<p>I found many broken links are recorded in SVN repository.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@server SVNRepositories]# svnadmin lstxns &nbsp;svnrepo<br />
23-1<br />
14-1<br />
42-1<br />
43-1<br />
34-1<br />
25-1<br />
42-2<br />
44-1<br />
34-2<br />
42-3<br />
17-1<br />
26-1<br />
43-2<br />
26-2<br />
37-1<br />
26-3</div></div>
<p>I did restart Apache as I use svn deployment over the mov_dav and it did not helpful.<br />
<strong>Removing all the queued/broken commits  </strong></p>
<p>Use the following method,</p>
<p>Eg: <strong>svnadmin rmtxns /path/to/svn `svnadmin lstxns /path/to/svn`</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@SVNRepositories]# svnadmin rmtxns myrepo `svnadmin lstxns myrepo` &nbsp;<br />
Transaction '23-1' removed.<br />
Transaction '14-1' removed.<br />
Transaction '42-1' removed.<br />
Transaction '43-1' removed.<br />
Transaction '34-1' removed.</div></div>
<p>That&#8217;s it.</p>
<p>To verify  </p>
<p><strong># svnadmin lstxns  myrepo</strong> shows  empty list  <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/05/03/subversion-removing-uncommitted-transactions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting RedHat to CentOS in online remotely</title>
		<link>http://www.serveridol.com/2012/04/30/converting-redhat-to-centos-in-online-remotely/</link>
		<comments>http://www.serveridol.com/2012/04/30/converting-redhat-to-centos-in-online-remotely/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 01:17:16 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RedHat EL5]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1626</guid>
		<description><![CDATA[<p>This is very rare scenario which come to face in your life. One of my friend had installed RedHat Enterprise Server 5.5 on his home network by the help of his friend. Unfortunately he doesn&#8217;t any redhat login info to register his OS to get redhat support and lost his DVD after the install. </p> [...]]]></description>
			<content:encoded><![CDATA[<p>This is very rare scenario which come to face in your life. One of my friend had  installed <strong>RedHat Enterprise Server 5.5</strong> on his home network by the help of his friend. Unfortunately he doesn&#8217;t any redhat login info to register his OS to get redhat support and lost his DVD after the install. </p>
<p>Now he contact me and asked me to help to install Subversion on his server. After  logged into the server, it is found that this server does not have svn installed and also I could not get the RedHat yum packages freely over the web. So I&#8217;m worried and stuck the installation time. Tried to enable various yum repositories but nothing gonna help me .. Really I lost hope and planning to move ahead with OS re-installation even though this server is located on another county <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Googling lead me to have some idea about enabling CentOS repository support to redhat. See this link http://www.tuxradar.com/answers/440</p>
<p>But this doesn&#8217;t work for me fully. Here is my solution. </p>
<p><strong>1. Removed the redhat repository entries from &#8220;/etc/yum.repos.d&#8221;</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;#rm -rf &nbsp;/etc/yum.repos.d/*</div></div>
<p><strong>2. Remove the rpm &#8220;redhat-release-5Server-5.5.0.2.i386&#8243;</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;#rpm -qa | grep &quot;redhat&quot; <br />
&nbsp; &nbsp; #rpm -e redhat-release-5Server-5.5.0.2 --nodeps</div></div>
<p>3.  You may need to find the CentOS alternative repository  ( here I  used CentOS 5.5 ) and <strong>downloaded  the rpm</strong> &#8220;<strong>centos-release-5-5.el5.centos.i386.rpm</strong>&#8221; and &#8220;<strong>centos-release-notes-5.5-0.i386.rpm</strong>&#8221;  Pls note : My OS architecture is 32 bit.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#rpm -ivh centos-release-notes-5.5-0.i386.rpm<br />
#rpm -ivh centos-release-5-5.el5.centos.i386.rpm</div></div>
<p>4. Grab the CentOS repository file respect to your OS distribution (<strong>here CentOS 5.5</strong>)<br />
    login to your CentOS machine which has the same redhat revison installed and grab the files &#8220;<strong>CentOS-Base.repo</strong>&#8221; and &#8220;<strong>CentOS-Media.repo</strong>&#8221; from &#8220;/etc/repos.d&#8221;</p>
<p>copy these files under &#8220;<strong>/etc/repos.d/</strong>&#8221;</p>
<p>5. <strong>Activate the new yum repository.</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># yum update</div></div>
<p>This steps will prompt to you to install new CentOS  kernel &#8220;<strong>kernel-PAE-2.6.18-194.el5</strong>&#8221; in order to enable centos package support.</p>
<p>Just go ahead PAE kernel installs and this will add new kernel entries in &#8220;<strong>/etc/grub.conf</strong>&#8221; and then reboot the server to load new kernel.</p>
<p>You will see new CentOS kernel loaded and you may continue to use the CentOS Package support using yum package manager.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@valuemobile ~]# rpm -qa | grep &quot;PAE&quot;<br />
kernel-PAE-2.6.18-308.4.1.el5.centos.plus<br />
kernel-PAE-devel-2.6.18-194.el5<br />
kernel-PAE-2.6.18-194.el5<br />
kernel-PAE-devel-2.6.18-308.4.1.el5.centos.plus<br />
[root@valuemobile ~]# uname -r<br />
2.6.18-308.4.1.el5.centos.plusPAE<br />
[root@valuemobile ~]#</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/04/30/converting-redhat-to-centos-in-online-remotely/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boosting site performance using Nginx, Php-FPM and APC</title>
		<link>http://www.serveridol.com/2012/04/17/boosting-site-performance-using-nginx-php-fpm-and-apc/</link>
		<comments>http://www.serveridol.com/2012/04/17/boosting-site-performance-using-nginx-php-fpm-and-apc/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 21:03:27 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Php-Fpm]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1618</guid>
		<description><![CDATA[<p>Earlier I had tried to boost the php based web application using Nginx weberver using php-cgi module. It&#8217;s also showing better performance compare to older Apache-Php module.</p> <p> Ngnix is the fastest http server and we are using the power of cgi scripts to boost the php compilation speed. Obviously the combination of Nginx+ php-cgi [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier I had tried to boost the php based web application using Nginx weberver using php-cgi module. It&#8217;s also showing better performance compare to older Apache-Php module.</p>
<p> <strong>Ngnix is the fastest http server </strong>and we are using the power of  cgi scripts to boost the php compilation speed. Obviously the combination of <a href="http://www.serveridol.com/2010/01/11/nginx-installing-and-configuring-on-centos-plesk-server/">Nginx+ php-cgi module </a> performs much better for small high speed websites. But this new technology <strong>php-fpm</strong> would also helpful to manage the different cgi requests effectively.</p>
<p>In this post,  I am using the power of <strong>php-fpm</strong> and <strong>APC</strong> which would accelerate the pages response time much more faster. Here you need to understand the role of diff application.</p>
<p> <strong>1. Nginx :</strong> It&#8217;s a fastest,  light weight  http webserver which is good for server static pages/files.<br />
<strong>2. Php-fpm (FastCGI Process Manager) :</strong> This is the manager for administrating cgi process.<br />
<strong>3. APC [Alternative PHP Cache]:</strong> This program will caches all the php request which had being executed recently and serves it when it requested next time until the cache expires. So it&#8217;s saves the execution time as well as server processing power.<br />
<strong>4. Memcache :</strong> It is used for caching mysql queries which is frequently executed by php.</p>
<p>Let&#8217;s start the server preparation.,</p>
<p>I would not recommend to do it on any existing production servers since this process requires php re-installation. So try it on fresh server ( Here i uses CentOS6.2 (64 bit).</p>
<p><strong>Installing PHP-FPM from Remi Repository.</strong> </p>
<p>Let&#8217;s completed the basic LAMP setup on new server and install the <strong>Remi-</strong> repository  suit to your platform. You may get the install document from <a href="http://wiki.centos.org/AdditionalResources/Repositories">here</a>, skip Apache,</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#yum install php* mysql* <br />
# wget http://rpms.famillecollet.com/enterprise/6/remi/x86_64/remi-release-6-1.el6.remi.noarch.rpm<br />
#rpm -ivh remi-release-6-1.el6.remi.noarch.rpm --nodeps<br />
#yum --enablerepo=remi install php php-fpm<br />
#chkconfig --level 345 php-fpm on<br />
#/etc/init.d/php-fpm restart<br />
[root@ ~]# netstat -nlp | grep &quot;9000&quot;<br />
tcp &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 127.0.0.1:9000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0:* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LISTEN &nbsp; &nbsp; &nbsp;10188/php-fpm<br />
[root@oyemedia ~]#<br />
#yum --enablerepo=remi install php-gd php-mysql php-mbstring php-xml php-mcrypt</div></div>
<p><strong>2. Installing Nginx from Repository</strong></p>
<p>Here we need to use the repository provided by the Ngnix  website. Create a repository file under &#8220;/etc/repos.d/&#8221; to grab it. Create a file named &#8220;<strong>/etc/yum.repos.d/nginx.repo</strong>&#8221; and add the following content.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[nginx]<br />
name=nginx repo<br />
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/<br />
gpgcheck=0<br />
enabled=1</div></div>
<p>Installing Nginx  using yum.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#vi /etc/yum.repos.d/nginx.repo<br />
#yum install nginx<br />
#chkconfig &nbsp;nginx on<br />
#service &nbsp;nginx start<br />
[root@ ~]# netstat -nlp | grep &quot;80&quot;<br />
tcp &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 0.0.0.0:80 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0.0.0.0:* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LISTEN &nbsp; &nbsp; &nbsp;32586/nginx<br />
[root@oyemedia ~]#</div></div>
<p><strong>3. Installing APC and memcache</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; #yum install gcc, make pcre<br />
#pecl install apc<br />
# yum install php-pecl-memcache<br />
#vi /etc/php.ini<br />
root@oyemedia ~]# php -m | egrep -E &quot;apc|memcache&quot;<br />
apc<br />
memcache</div></div>
<p>Add the APC extenion in <strong>/etc/php.ini </strong>file eg: extension = apc.so. You may configure it&#8217;s value by adding/modifying the values in &#8221; <strong>/etc/php.d/apc.ini&#8221;</strong> file as well. </p>
<p>We have completed the half part of the setup.</p>
<p>Next we need to re-tune the Nginx for  servicing Php pages along with zip compression enabled. This is the virtual host file for serving joomla site. You may download the files from <a href="http://www.serveridol.com/scripts/ngnix_virtual_host.conf">here</a></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server {<br />
&nbsp; &nbsp;server_name &nbsp;mydomain.com;<br />
&nbsp; &nbsp;listen &nbsp; &nbsp;174.28.17.98:80;<br />
&nbsp; &nbsp; rewrite ^(.*) http://www.mydomain.com$1 permanent;<br />
}<br />
server {<br />
&nbsp; listen &nbsp; &nbsp;174.28.17.98:80;<br />
&nbsp; server_name &nbsp; www.mydomain.com ;<br />
&nbsp; access_log &nbsp; &nbsp; &nbsp;/home/mydomain/access.log;<br />
&nbsp; error_log &nbsp; &nbsp; /home/mydomain/public_html/error.log &nbsp;warn<br />
&nbsp; root &nbsp; &nbsp; &nbsp; &nbsp;/home/mydomain/public_html;<br />
&nbsp; index &nbsp; &nbsp; &nbsp; index.php index.html;<br />
<br />
client_header_timeout 240s;<br />
client_body_timeout 240s;<br />
fastcgi_read_timeout 240s;<br />
<br />
location / {<br />
&nbsp; &nbsp; expires 30d;<br />
&nbsp; &nbsp; error_page 404 = @joomla;<br />
&nbsp; &nbsp; log_not_found off;<br />
<br />
&nbsp; &nbsp; try_files $uri $uri/ /index.php?q=$request_uri;<br />
}<br />
<br />
&nbsp;location @joomla {<br />
&nbsp; &nbsp; rewrite ^(.*)$ /index.php?q=$1 last;<br />
&nbsp;}<br />
<br />
error_page 500 502 503 504 404 &nbsp;/404.html;<br />
&nbsp; &nbsp; &nbsp; &nbsp; location = /404.html {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;root &nbsp;/home/mydomain/public_html/;<br />
&nbsp; &nbsp; &nbsp;}<br />
<br />
gzip on;<br />
gzip_http_version 1.1;<br />
gzip_comp_level 4;<br />
gzip_min_length 1100;<br />
gzip_buffers 4 8k;<br />
gzip_types text/plain application/xhtml+xml text/css application/xml application/xml+rss text/javascript <br />
<br />
application/javascript application/x-javascr$<br />
gzip_proxied any;<br />
gzip_disable &quot;MSIE [1-6]\.&quot;;<br />
<br />
# caching of files<br />
location ~* \.(ico|pdf|flv)$ {<br />
expires 60d;<br />
}<br />
<br />
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {<br />
expires 14d;<br />
}<br />
<br />
location ~ \.php$ {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; html;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_pass &nbsp; 127.0.0.1:9000;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_index &nbsp;index.php;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fastcgi_param &nbsp;SCRIPT_FILENAME &nbsp; /home/mydomain/public_html$fastcgi_script_name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; include &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_params;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
# Select files to be deserved by nginx<br />
&nbsp;location ~* ^.+.(swf|zip|rar|html|htm|pdf)$ {<br />
#location ~* ^.+.(zip|rar|html|htm|pdf)$ {<br />
&nbsp; &nbsp; root &nbsp;/home/mydomain/public_html/;<br />
&nbsp; &nbsp; expires &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7d;<br />
&nbsp; }<br />
}</div></div>
<blockquote><p>Note : You may need to change the ip address [174.28.17.98:80] and the web location [ /home/mydomain/public_html] according to your setup.
</p></blockquote>
<p>Now test the Nginx config and restart the  service,</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@ ~]# service nginx configtest<br />
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok<br />
nginx: configuration file /etc/nginx/nginx.conf test is successful<br />
[root@oyemedia ~]# service nginx restart<br />
Stopping nginx: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ &nbsp;OK &nbsp;]<br />
Starting nginx: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ &nbsp;OK &nbsp;]<br />
[root@ ~]#</div></div>
<p><a href="http://www.serveridol.com/wp-content/uploads/2012/04/ngnix.jpg"><img src="http://www.serveridol.com/wp-content/uploads/2012/04/ngnix-300x237.jpg" alt="" title="ngnix" width="300" height="237" class="alignnone size-medium wp-image-1619" /></a></p>
<p>Whola !!! <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  That&#8217;s it. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/04/17/boosting-site-performance-using-nginx-php-fpm-and-apc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH auto login to linux server from Windows using Putty.</title>
		<link>http://www.serveridol.com/2012/04/13/ssh-auto-login-to-linux-server-from-windows-using-putty/</link>
		<comments>http://www.serveridol.com/2012/04/13/ssh-auto-login-to-linux-server-from-windows-using-putty/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 15:55:38 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Putty]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1592</guid>
		<description><![CDATA[<p>I&#8217;m using windows desktop and always half part of the screen is filled up with many puty screens. Sometimes I have to be logged for long time and sometimes not. I frequently disconnected as the my router device wil terminate the tcp connection which is idle more than 5 minutes. it&#8217;s so sad . </p> [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using windows desktop and always half part of the screen is filled up with many puty screens.  Sometimes I have to be logged for long time and sometimes not.   I frequently disconnected as the my router device wil terminate the tcp connection which is idle more than 5 minutes. it&#8217;s so sad <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> . </p>
<p>So I have many number of &#8220;putty logins&#8221; in a day which required to open/run the putty application, find the exact password from file etc which is a kind of disturbance <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I think. Now I want to save the effort, faster sever access and  minimize the time spend for this putty logins.</p>
<p><strong>1. Generate the public key and private key files.</strong></p>
<p><a href="http://www.serveridol.com/wp-content/uploads/2012/04/putty-11.jpg"><img src="http://www.serveridol.com/wp-content/uploads/2012/04/putty-11-300x293.jpg" alt="" title="putty-1" width="300" height="293" class="alignnone size-medium wp-image-1601" /></a></p>
<p> Download <strong>PuTTYgen.exe </strong>from <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">here</a> and run the application.  Click on generate button to generate both private and public key. Copy the public key to clipboard shown on the screen. Also <strong>save the private key</strong> in a secure location on your drives. This key is require for the file authentication  </p>
<blockquote><p> Pls note anyone can login to the server using this private  file with the assumption of user and server ip.</p></blockquote>
<p><strong>2. Storing public key in Server. </strong></p>
<p> SSH login to the server to which you access  without login and  create authorization file (&#8220;<strong>~/.ssh/authorized_keys</strong>&#8220;) and copy the clip board content which had copied the public key.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@rc-090 ~]# vi ~/.ssh/authorized_keys</div></div>
<p>That&#8217;s it . All  are rest. </p>
<p>Login to remote linux machine,<br />
<strong>3. Connecting server using putty </strong></p>
<p>Download <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">putty</a> and run it. </p>
<p> Now you need to give</p>
<p><strong>a. host name  including user name and the server name. </strong><br />
<strong>b. Label for storing this login details.</strong><br />
<strong>c. Choose the private key file and save the label. See the screen,</strong></p>
<p><a href="http://www.serveridol.com/wp-content/uploads/2012/04/putty-23.jpg"><img src="http://www.serveridol.com/wp-content/uploads/2012/04/putty-23-300x289.jpg" alt="" title="putty-2" width="300" height="289" class="alignnone size-medium wp-image-1603" /></a><br />
<a href="http://www.serveridol.com/wp-content/uploads/2012/04/putty-31.jpg"><img src="http://www.serveridol.com/wp-content/uploads/2012/04/putty-31-300x292.jpg" alt="" title="putty-3" width="300" height="292" class="alignnone size-medium wp-image-1604" /></a></p>
<p>You will see the following screen once you logged in to the server,</p>
<p><a href="http://www.serveridol.com/wp-content/uploads/2012/04/putty-41.jpg"><img src="http://www.serveridol.com/wp-content/uploads/2012/04/putty-41-300x49.jpg" alt="" title="putty-4" width="300" height="49" class="alignnone size-medium wp-image-1605" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/04/13/ssh-auto-login-to-linux-server-from-windows-using-putty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL : interactive_timeout v/s wait_timeout</title>
		<link>http://www.serveridol.com/2012/04/13/mysql-interactive_timeout-vs-wait_timeout/</link>
		<comments>http://www.serveridol.com/2012/04/13/mysql-interactive_timeout-vs-wait_timeout/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 12:57:51 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1588</guid>
		<description><![CDATA[<p>Most of the database intensive applications are worring about the default values of these variables obviously. Developers used to inform me that they need to extend the wait_timeout value in order to complete the query execution.</p> <p>After some googling, it is found that default &#8220;wait_timeout&#8221; value is good enough. We may need to reduce it [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the database intensive applications are worring about the default values of these variables obviously.  Developers used to inform me that they need to extend the <strong>wait_timeout</strong> value in order to complete the query execution.</p>
<p>After some googling, it is found that  default &#8220;<strong>wait_timeout</strong>&#8221; value is good enough. We may need to reduce it to boost the server performance which will helpful to minimize the &#8220;sleep&#8221; process loaded in memory. Increasing number of sleeping process will reduces the server performance gradually. So always keep the default value and make it reduce until the program/application does not create any sleeping process which would helpful to improve the performance noticeable. <strong>Slow_log_query </strong>is another possible reason to have many sleeping process.</p>
<p><strong>interactive_timeout </strong> : interactive time out for mysql shell sessions in seconds like mysqldump or mysql command line tools.<br />
<strong>wait_timeout&#8221; : </strong> the amount of seconds during inactivity that MySQL will wait before it will close a connection on a non-interactive connection in seconds.</p>
<p><strong>How to change the these variables</strong></p>
<p><strong>a. changing values at run time </strong><br />
 Log in to the mysql console and set the variable.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;mysql&gt; SET &nbsp;interactive_timeout=200;<br />
Query OK, 0 rows affected (0.01 sec)<br />
<br />
mysql&gt; SET GLOBAL &nbsp;interactive_timeout=200;<br />
Query OK, 0 rows affected (0.00 sec)<br />
<br />
mysql&gt; show variables like &quot;%timeout%&quot;;<br />
+----------------------------+-------+<br />
| Variable_name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Value |<br />
+----------------------------+-------+<br />
| connect_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 200 &nbsp;|<br />
| delayed_insert_timeout &nbsp; &nbsp; | 300 &nbsp; |<br />
| innodb_lock_wait_timeout &nbsp; | 50 &nbsp; &nbsp;|<br />
| innodb_rollback_on_timeout | OFF &nbsp; |<br />
| interactive_timeout &nbsp; &nbsp; &nbsp; &nbsp;| 200 |<br />
| net_read_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | 200 &nbsp;|<br />
| net_write_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 200 &nbsp;|<br />
| slave_net_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 3600 &nbsp;|<br />
| table_lock_wait_timeout &nbsp; &nbsp;| 50 &nbsp; &nbsp;|<br />
| wait_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | 200 |<br />
+----------------------------+-------+<br />
10 rows in set (0.00 sec)</div></div>
<p>b. <strong>Using my.cnf</strong> : Add the following values in /etc/my.cnf&#8221; and restart the mysql server.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;[mysqld]<br />
interactive_timeout=180<br />
wait_timeout=180</div></div>
<p>Pls note that &#8220;<strong>wait_timeout</strong>&#8221; would be helpful to clear  the sleeping process as &#8220;<strong>interactive_timeout</strong>&#8221; does not make any performance improvement since it affect the command line sessions. Obviously  increasing the values of <strong>connect_timeout</strong>, <strong>net_read_timeout</strong> and <strong>net_write_timeout</strong> would help to skip the timeout errors when lengthy queries are being executed.</p>
<p><strong>How to kill the MySQL Sleeping process</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;mysql&gt; show full processlist;<br />
+-------+------------+---------------------+---------------+---------+------+-------+-----------------------+<br />
| Id &nbsp; &nbsp;| User &nbsp; &nbsp; &nbsp; | Host &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| db &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Command | Time | State | Info &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
+-------+------------+---------------------+---------------+---------+------+-------+-----------------------+<br />
| &nbsp;9435 | user | 192.168.10.15:52180 | db1 | Sleep &nbsp; | &nbsp; 26 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| &nbsp;9943 | user | localhost:51179 &nbsp; &nbsp; | db2 &nbsp; &nbsp; &nbsp; &nbsp; | Sleep &nbsp; | &nbsp; &nbsp;1 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| &nbsp;9944 | user | localhost:54007 &nbsp; &nbsp; | db2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Sleep &nbsp; | &nbsp; 29 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| &nbsp;9947 | user | localhost:60638 &nbsp; &nbsp; | db2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | Sleep &nbsp; | &nbsp; 29 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| 10716 | root &nbsp; &nbsp; &nbsp; | localhost &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Sleep &nbsp; | 5432 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| 10851 | root &nbsp; &nbsp; &nbsp; | localhost &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Query &nbsp; | &nbsp; &nbsp;0 | NULL &nbsp;| show full processlist |<br />
+-------+------------+---------------------+---------------+---------+------+-------+-----------------------+<br />
6 rows in set (0.00 sec)<br />
<br />
mysql&gt; kill 9944;<br />
Query OK, 0 rows affected (0.00 sec)<br />
<br />
mysql&gt; show full processlist;<br />
+-------+------------+---------------------+---------------+---------+------+-------+-----------------------+<br />
| Id &nbsp; &nbsp;| User &nbsp; &nbsp; &nbsp; | Host &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| db &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Command | Time | State | Info &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
+-------+------------+---------------------+---------------+---------+------+-------+-----------------------+<br />
| &nbsp;9435 | user | 192.168.10.15:52180 | db1 | Sleep &nbsp; | &nbsp; &nbsp;7 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| &nbsp;9943 | user | localhost:51179 &nbsp; &nbsp; | db2 &nbsp; &nbsp; &nbsp; &nbsp; | Sleep &nbsp; | &nbsp; &nbsp;9 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| &nbsp;9947 | user | localhost:60638 &nbsp; &nbsp; | db2 &nbsp; &nbsp; &nbsp; &nbsp; | Sleep &nbsp; | &nbsp; 10 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| 10716 | root &nbsp; &nbsp; &nbsp; | localhost &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Sleep &nbsp; | 5473 | &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|<br />
| 10851 | root &nbsp; &nbsp; &nbsp; | localhost &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | NULL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Query &nbsp; | &nbsp; &nbsp;0 | NULL &nbsp;| show full processlist |<br />
| +-------+------------+---------------------+---------------+---------+------+-------+-----------------------+<br />
7 rows in set (0.01 sec)<br />
mysql&gt;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/04/13/mysql-interactive_timeout-vs-wait_timeout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios : Enabling FREE SMS notification [INDIA]</title>
		<link>http://www.serveridol.com/2012/04/07/nagios-enabling-sms-notification-freely/</link>
		<comments>http://www.serveridol.com/2012/04/07/nagios-enabling-sms-notification-freely/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 14:07:55 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nagios]]></category>
		<category><![CDATA[Web security]]></category>
		<category><![CDATA[SMS]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1579</guid>
		<description><![CDATA[<p>Here I found some good trick to enable Nagios sms notification free for Indian users using one of the sms free service offered by way2sms website. have a look at way2sms.com.</p> <p>Most of the cases I used to take tiny pieces of information from different blog sites and customize and modify it for my purpose. [...]]]></description>
			<content:encoded><![CDATA[<p>Here  I found some good trick to enable Nagios sms notification free for Indian users using one of  the sms free service offered  by way2sms website. have a look at way2sms.com.</p>
<p>Most of the cases I used to take tiny pieces of information from different blog sites and customize and modify it for my purpose. This website (brijin.net) has the python script to send sms using way2sms. I&#8217;m thanking to that blog owner <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . </p>
<p>Action involved are,</p>
<p>1. Register new account with way2sms.com.<br />
2. Configure python script<br />
3. Add the new nagios command for enabling sms notification for  service and host failure.<br />
4. Update the contact information.</p>
<p><strong>1. Create an account with  way2sms.com </strong></p>
<p>Register your moble and this service company send you the login details over sms. You need this login information in python script to send sms. This script just does the normal web login to send sms.</p>
<p><strong>2. Install python script</strong></p>
<p>Create a script under &#8220;<strong>/usr/local/nagios/libexec/send_sms.py</strong>&#8220;. You may need to update the following fields in the script<br />
<strong>br["username"] = &#8220;&#8221;  #YOUR MOBILE NUMBER HERE<br />
br["password"] = &#8220;&#8221;  #YOUR PASSWORD HERE</strong></p>
<p>Here is the script content.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/usr/bin/env python <br />
<br />
import sys<br />
import time<br />
try:<br />
&nbsp; &nbsp; import mechanize<br />
except ImportError:<br />
&nbsp; &nbsp; print &quot;Please install mechanize module for python&quot;<br />
&nbsp; &nbsp; print &quot;Install python-mechanize, if you are on a Ubuntu/Debian machine&quot;<br />
&nbsp; &nbsp; sys.exit(1)<br />
try:<br />
&nbsp; &nbsp; from optparse import OptionParser<br />
except ImportError:<br />
&nbsp; &nbsp; print &quot;Error importing optparse module&quot;<br />
&nbsp; &nbsp; sys.exit(1)<br />
<br />
def SendSMS(mobile,text):<br />
&nbsp; &nbsp; print &quot;&gt;&gt;&gt; initializing..&quot;<br />
&nbsp; &nbsp; br = mechanize.Browser()<br />
&nbsp; &nbsp; print &quot;&gt;&gt;&gt; connecting to way2sms...&quot;<br />
&nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp;br.open(&quot;http://site3.way2sms.com/entry.jsp&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp;br.select_form(name=&quot;loginform&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp;br[&quot;username&quot;] = &quot;&quot; &nbsp;#YOUR MOBILE NUMBER HERE<br />
&nbsp; &nbsp; &nbsp; &nbsp;br[&quot;password&quot;] = &quot;&quot; &nbsp;#YOUR PASSWORD HERE<br />
&nbsp; &nbsp; &nbsp; &nbsp;br.form.method=&quot;POST&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;br.form.action=&quot;http://site1.way2sms.com/Login1.action&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;print &quot;&gt;&gt;&gt; &quot; + br.title()<br />
&nbsp; &nbsp; &nbsp; &nbsp;response = br.submit()<br />
&nbsp; &nbsp; &nbsp; &nbsp;response.get_data()<br />
&nbsp; &nbsp; &nbsp; &nbsp;print &quot;&gt;&gt;&gt; logged in..&quot;<br />
&nbsp; &nbsp; except:<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;&gt;&gt;&gt; FATAL: Error occurred while login process!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; sys.exit(1)<br />
&nbsp; &nbsp; try:<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;&gt;&gt;&gt; sending message...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; br.open(&quot;http://site1.way2sms.com/jsp/InstantSMS.jsp&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; br.select_form(name=&quot;InstantSMS&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; br[&quot;MobNo&quot;] &nbsp; &nbsp; &nbsp;= mobile<br />
&nbsp; &nbsp; &nbsp; &nbsp; br[&quot;textArea&quot;] &nbsp; = text<br />
&nbsp; &nbsp; &nbsp; &nbsp; br.form.method=&quot;POST&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; br.form.action=&quot;http://site1.way2sms.com/quicksms.action&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; response = br.submit()<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;&gt;&gt;&gt; submitting...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;&gt;&gt;&gt; logging out...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; br.open(&quot;http://site1.way2sms.com/jsp/logout.jsp&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; br.close()<br />
&nbsp; &nbsp; except:<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;&gt;&gt;&gt; html seems to be changed!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; print &quot;&gt;&gt;&gt; please modify the program to work with newly modified website!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; sys.exit(1)<br />
<br />
def main():<br />
&nbsp; &nbsp; parser = OptionParser()<br />
&nbsp; &nbsp; usage = &quot;Usage: %prog -m [number] -t [text]&quot;<br />
&nbsp; &nbsp; parser = OptionParser(usage=usage, version=&quot;%prog 1.0&quot;)<br />
&nbsp; &nbsp; parser.add_option(&quot;-m&quot;, &quot;--number&quot;, &nbsp;action=&quot;store&quot;, type=&quot;string&quot;,dest=&quot;number&quot;, &nbsp;help=&quot;Mobile number to send sms&quot;)<br />
&nbsp; &nbsp; parser.add_option(&quot;-t&quot;, &quot;--text&quot;, action=&quot;store&quot;, type=&quot;string&quot;, dest=&quot;text&quot;, help=&quot;Text to send&quot;)<br />
&nbsp; &nbsp; (options, args) = parser.parse_args()<br />
&nbsp; &nbsp; if options.number and options.text:<br />
&nbsp; &nbsp; &nbsp; &nbsp;SendSMS(options.number,options.text)<br />
&nbsp; &nbsp; else:<br />
&nbsp; &nbsp; &nbsp; &nbsp;print &quot;Fatal: Required arguments are missing!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;print &quot;Use: -h / --help to get help.&quot;<br />
<br />
if __name__ == &quot;__main__&quot;:<br />
&nbsp; &nbsp;main()</div></div>
<p>Now you need to install python-mechanize in order to work this script. so you need to install  python package installer program &#8220;<strong>eazy_install&#8221;</strong> which shipped with<strong> setuptools</strong>.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@nagios /]# wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e<br />
[root@nagios /]# tar -zxvf setuptools-0.6c11.tar.gz<br />
[root@nagios /]# cd setuptools-0.6c11<br />
[root@nagios setuptools-0.6c11]# python ./setup.py install<br />
[root@nagios setuptools-0.6c11]# easy_install mechanize</div></div>
<p>Now you need to verify the packages are correctly installed.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@nagios ~]# python &nbsp;/usr/local/nagios/libexec/send_sms.py -h<br />
usage: Usage: send_sms.py -m [number] -t [text]<br />
<br />
options:<br />
&nbsp; --version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; show program's version number and exit<br />
&nbsp; -h, --help &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;show this help message and exit<br />
&nbsp; -m NUMBER, --number=NUMBER<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Mobile number to send sms<br />
&nbsp; -t TEXT, --text=TEXT &nbsp;Text to send<br />
[root@nagios ~]#</div></div>
<p><strong>Sending  test sms </strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@nagios ~]# python &nbsp;/usr/local/nagios/libexec/send_sms.py -m 94977720 -t &quot; Testing Nagios notification&quot;<br />
&gt;&gt;&gt; initializing..<br />
&gt;&gt;&gt; connecting to way2sms...<br />
&gt;&gt;&gt; Free SMS, Send Free SMS, Send Free SMS to india, Free email alerts, email2SMS, SMS Alerts,Bill Reminders, EMI Reminders, Loan Reminders, TV Shows Reminders, Future SMS, Mobile Bill Reminders<br />
&gt;&gt;&gt; logged in..<br />
&gt;&gt;&gt; sending message...<br />
&gt;&gt;&gt; submitting...<br />
&gt;&gt;&gt; logging out...<br />
[root@nagios ~]#</div></div>
<p>So your installation looks good.</p>
<p><strong>3. Updating &#8220;/usr/local/nagios/etc/objects/commands.cfg&#8221; file</strong><br />
Open the file and append the following lines at the end of file</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">define command{<br />
&nbsp; &nbsp; command_name &nbsp; &nbsp;notify-host-by-sms<br />
&nbsp; &nbsp; command_line &nbsp; &nbsp;/usr/local/nagios/libexec/send_sms.py &nbsp;-m $CONTACTPAGER$ -t &quot;Type: $NOTIFICATIONTYPE$\<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Host: $HOSTNAME$ \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State: $HOSTSTATE$ \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Address: $HOSTADDRESS$ \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Info: $HOSTOUTPUT$ Time: $LONGDATETIME$&quot;<br />
}<br />
<br />
define command{<br />
&nbsp; &nbsp; command_name &nbsp; &nbsp;notify-service-by-sms<br />
&nbsp; &nbsp; command_line &nbsp; &nbsp;/usr/local/nagios/libexec/send_sms.py &nbsp;-m $CONTACTPAGER$ &nbsp;-t &quot;Type: $NOTIFICATIONTYPE$\<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Host: $HOSTNAME$ \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Service: $SERVICEDESC$ \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State: $SERVICESTATE$ \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Date/Time: $LONGDATETIME$ Additional Info:$SERVICEOUTPUT$&quot;<br />
}</div></div>
<p><strong>4. Update your contact information (/usr/local/nagios/etc/objects/contacts.cfg)</strong></p>
<p> You may need to add 3 lines in it.</p>
<p><strong>service_notification_commands notify-service-by-email,notify-service-by-sms<br />
host_notification_commands notify-host-by-email,notify-service-by-sms<br />
pager 9744209638</strong></p>
<p>My sample contact will look like this.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">define contact{<br />
contact_name &nbsp; &nbsp;liju<br />
use &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generic-contact<br />
alias &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Liju Mathew<br />
email &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; liju@serveridol.com<br />
service_notification_commands notify-service-by-email,notify-service-by-sms<br />
host_notification_commands notify-host-by-email,notify-service-by-sms<br />
pager 94000000<br />
&nbsp;}</div></div>
<p>[root@nagios ~]# service nagios restart<br />
Running configuration check&#8230;done.<br />
Stopping nagios: done.<br />
Starting nagios: done.<br />
[root@nagios ~]#</p>
<p>Then simply restart Nagios service. For the testing purpose you may set one incorrect service name which was not defined in <strong>nrpe</strong> commands list. So that you get a notification sms and have the test easily.</p>
<p>Cool !!!  Now you have ABSOLUTELY FREE nagios sms alert facility. </p>
<p>You may also use this script for sending sms if any critical systems/process reached the threshold limit like backup failure, intruder detention found  etc. etc. </p>
<p>nJnoy <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/04/07/nagios-enabling-sms-notification-freely/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CentOS : Extending default memory limit</title>
		<link>http://www.serveridol.com/2012/03/26/centos-extending-default-memory-limit/</link>
		<comments>http://www.serveridol.com/2012/03/26/centos-extending-default-memory-limit/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 13:43:04 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PAE]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1574</guid>
		<description><![CDATA[<p>One of the CentOS box is not identified the exact RAM which had up-graded to 4GB. We are using CentOS 5.3 version. As a quick fix for this solution is to install new kernel which support PAE (Physical Address Extension) is a feature to allow (32-bit) x86 processors to access a physical address space (including [...]]]></description>
			<content:encoded><![CDATA[<p>One of the CentOS box is  not identified the exact RAM which had up-graded to 4GB. We are using CentOS 5.3 version. As a quick fix for this solution is to install new kernel which support PAE (Physical Address Extension) is a feature to allow (32-bit) x86 processors to access a physical address space (including random access memory and memory mapped devices) larger than 4 gigabytes.</p>
<p>So you need to install new kernel which support PAE. In CentOS install &#8220;<strong>kernel-PAE</strong>&#8221; package to do this.  </p>
<p>Before the modification, the desktop has showing 3.2GB only</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@rc-147 ~]# free -m<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp; &nbsp; free &nbsp; &nbsp; shared &nbsp; &nbsp;buffers &nbsp; &nbsp; cached<br />
Mem: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3286 &nbsp; &nbsp; &nbsp; 3177 &nbsp; &nbsp; &nbsp; &nbsp;109 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;178 &nbsp; &nbsp; &nbsp; &nbsp;518<br />
-/+ buffers/cache: &nbsp; &nbsp; &nbsp; 2480 &nbsp; &nbsp; &nbsp; &nbsp;806<br />
Swap: &nbsp; &nbsp; &nbsp; &nbsp; 2000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 2000<br />
[root@rc-147 ~]#</div></div>
<p><strong>1. Installing  Kernel PAE package</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@rc-147 yum.repos.d]# yum install kernel-PAE<br />
Loaded plugins: fastestmirror<br />
Determining fastest mirrors<br />
My-Repo-Centos-5 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp;951 B &nbsp; &nbsp; 00:00<br />
primary.xml.gz &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 936 kB &nbsp; &nbsp; 00:00<br />
Rain-Concert-Centos-5 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2628/2628<br />
Setting up Install Process<br />
Parsing package install arguments<br />
Resolving Dependencies<br />
There are unfinished transactions remaining. You migh tconsider running yum-complete-transaction first to finish them.<br />
--&gt; Running transaction check<br />
---&gt; Package kernel-PAE.i686 0:2.6.18-194.el5 set to be installed<br />
--&gt; Finished Dependency Resolution<br />
Dependencies Resolved<br />
Dependencies Resolved<br />
=============================================================================<br />
&nbsp;Package &nbsp; &nbsp; &nbsp; &nbsp;Arch &nbsp; &nbsp; Version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Repository &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size<br />
=============================================================================<br />
Installing:<br />
&nbsp;kernel-PAE &nbsp; &nbsp; i686 &nbsp; &nbsp; 2.6.18-194.el5 &nbsp; &nbsp; &nbsp;My-Repo-Centos-5 &nbsp; &nbsp; &nbsp;17 M<br />
Transaction Summary<br />
=============================================================================<br />
Install &nbsp; &nbsp; &nbsp;1 Package(s)<br />
Update &nbsp; &nbsp; &nbsp; 0 Package(s)<br />
Remove &nbsp; &nbsp; &nbsp; 0 Package(s)<br />
Total download size: 17 M<br />
Is this ok [y/N]: y<br />
Downloading Packages:<br />
kernel-PAE-2.6.18-194.el5.i686.rpm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp;17 MB &nbsp; &nbsp; 00:01<br />
Running rpm_check_debug<br />
Running Transaction Test<br />
Finished Transaction Test<br />
Transaction Test Succeeded<br />
Running Transaction<br />
&nbsp; Installing &nbsp; &nbsp; : kernel-PAE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1/1]<br />
Installed: kernel-PAE.i686 0:2.6.18-194.el5<br />
Complete!<br />
[root@rc-147 yum.repos.d]#</div></div>
<p><strong>2. Enabling new kernel entry in &#8220;/etc/grub.conf&#8221;</strong></p>
<p> <strong>2. Change the default boot option to 0. Note the new kernel entry listed in it (vmlinuz-2.6.18-194.el5PAE) </strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#cat /etc/grub.conf&quot;<br />
default=0<br />
timeout=5<br />
splashimage=(hd0,0)/grub/splash.xpm.gz<br />
password --md5 $1$SXQbd/$cg/35eLfANUf7rUxiPX0u.<br />
hiddenmenu<br />
title CentOS (2.6.18-194.el5PAE)<br />
&nbsp; &nbsp; &nbsp; &nbsp; root (hd0,0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; kernel /vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/ rhgb quiet<br />
&nbsp; &nbsp; &nbsp; &nbsp; initrd /initrd-2.6.18-194.el5PAE.img<br />
title CentOS (2.6.18-128.el5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; root (hd0,0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; kernel /vmlinuz-2.6.18-128.el5 ro root=LABEL=/ rhgb quiet<br />
&nbsp; &nbsp; &nbsp; &nbsp; initrd /initrd-2.6.18-128.el5.img</div></div>
<p><strong>3. Reboot the server.</strong></p>
<p>Verify the memory status</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@rc-1147 ~]# free -m<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp; &nbsp; free &nbsp; &nbsp; shared &nbsp; &nbsp;buffers &nbsp; &nbsp; cached<br />
Mem: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4041 &nbsp; &nbsp; &nbsp; 2284 &nbsp; &nbsp; &nbsp; 1756 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;258 &nbsp; &nbsp; &nbsp; &nbsp;735<br />
-/+ buffers/cache: &nbsp; &nbsp; &nbsp; 1290 &nbsp; &nbsp; &nbsp; 2750<br />
Swap: &nbsp; &nbsp; &nbsp; &nbsp; 2047 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 2047<br />
[root@rc-163 ~]#<br />
[root@rc-163 ~]# uname -rmo<br />
2.6.18-164.el5PAE i686 GNU/Linux<br />
[root@rc-163 ~]#</div></div>
<p>That&#8217;s it -:)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/03/26/centos-extending-default-memory-limit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux : Configuring secure sftp server</title>
		<link>http://www.serveridol.com/2012/03/10/linux-configuring-secure-sftp-server/</link>
		<comments>http://www.serveridol.com/2012/03/10/linux-configuring-secure-sftp-server/#comments</comments>
		<pubDate>Sat, 10 Mar 2012 16:13:20 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[SFTP]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1568</guid>
		<description><![CDATA[<p>As we all know, most system users can have sftp access to Linux box by default along with ssh access. So that we can transfer the files securely over it.</p> <p>But the real headache of this system is, all the users can access any of system files and also has shell access to the server [...]]]></description>
			<content:encoded><![CDATA[<p>As we all know, most system users can have sftp access to Linux box by default along with ssh access. So that we can transfer the files securely over it.</p>
<p>But the real headache of this system is, all the users can access any of system files and also has shell access to the server which will open a door to a authorized stranger to know about the server roles and can grab the imp. files he wants. </p>
<p><strong>Drawback :</strong> What I found is sftp system doesn&#8217;t have any log  facility ie no record if  any file transactions which done over it. So that we can&#8217;t trace out what are happening once the sftp session started. Also most of the latest
<ul>
Redhat/CentOS OS still using the older openssh version which doesn&#8217;t support chroot ssh setup.</ul>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;-sh-3.2# ssh -version<br />
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008<br />
Bad escape character 'rsion'.<br />
-sh-3.2# cat /etc/redhat-release<br />
CentOS release 5.5 (Final)</div></div>
<p>What I&#8217;m planning to do is,</p>
<p><strong>1. Install a new openssh server and run it over on a new port for only sftp access<br />
2.  Set a chroot restriction to all users.<br />
3. It won&#8217;t  harm any production servers.<br />
</strong></p>
<p><strong>1. Installing openssh package</strong></p>
<p>1. Download  openssh package from http://www.openssh.org/portable.html</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@web01 ~]#cd /home/installation/<br />
[root@web01 ~]#wget http://ftp.wu-wien.ac.at/pub/OpenBSD/OpenSSH/portable/openssh-5.9p1.tar.gz<br />
[root@web01 ~]#tar -zxvf openssh-5.9p1.tar.gz<br />
[root@web01 ~]cd openssh-5.9p1<br />
[root@web01 ~]./configure --prefix=/var/opt/openssh<br />
[root@web01 ~]make<br />
[root@web01 ~]make install<br />
[root@web01 ~] ln -s /var/opt/openssh/sbin/sshd /usr/sbin/sftpserver</div></div>
<p>Now all the openssh files are copied under &#8220;/var/opt/openssh&#8221; folder. Next we need to create a startup script for as a service. </p>
<p>[root@fc-web01 ~]#<strong> vi /etc/init.d/opensshd</strong><br />
Which having the following lines,</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/bin/bash<br />
# chkconfig: 35 60 25<br />
# description: OpenSSH chrooted sftp only daemon<br />
#<br />
# Note that /usr/sbin/sftpfoo is simply a symlink to /usr/sbin/sshd<br />
#<br />
pidfile='/var/run/sftpserver.pid'<br />
case &quot;${1}&quot; in<br />
start &nbsp;) exec -a /usr/sbin/sftpserver /var/opt/openssh/sbin/sshd -f /var/opt/openssh/etc/sshd_config<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;;<br />
stop &nbsp; ) kill -9 $(cat ${pidfile})<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;;<br />
restart) stop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sleep 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;start<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;;<br />
* &nbsp; &nbsp; &nbsp;) echo &quot;Usage: ${0} (start|stop|restart)&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;;<br />
esac<br />
<br />
exit 0</div></div>
<p><strong>2. Modifying SSH config file</strong></p>
<p>You may need to add the following line at the bottom of &#8216; <strong>/var/opt/openssh/etc/sshd_config</strong>&#8221; file</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Subsystem &nbsp; &nbsp; sftp &nbsp; internal-sftp<br />
Match Group sftp<br />
ChrootDirectory %h<br />
ForceCommand internal-sftp<br />
AllowTcpForwarding no</div></div>
<p>Note: You must have define new ssh port in this file (Eg. <strong>Port 22222</strong> ) you may need to delete/comment the  line start with &#8220;<strong>#Subsystem      sftp    /var/opt/openssh/libexec/sftp-server</strong> &#8221; </p>
<p><strong>3. User configuration</strong></p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@web01 ~]#groupadd sftp ;Creating sftp group<br />
[root@web01 ~]#mkdir -p /home/chroot/home ;creating &nbsp;chroot jailed home directory</div></div>
<ul>Adding users with disabled shell access</ul>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;[root@web01 ~]#useradd -G sftp &nbsp;-s /bin/false -d /home/chroot/home/sftpuser1 sftpuser1<br />
[root@web01 ~]#chown root:root /home/chroot/home/sftpuser1<br />
[root@web01 ~]#chmod -R 0755 /home/chroot/home/sftpuser1<br />
[root@web01 ~]#rm -rf &nbsp;/home/chroot/home/sftpuser1/*<br />
[root@web01 ~]#mkdir -p &nbsp;/home/chroot/home/sftpuser1/upload<br />
[root@web01 ~]#mkdir -p &nbsp;/home/chroot/home/sftpuser1/download<br />
[root@web01 ~]#mkdir -p &nbsp;/home/chroot/home/sftpuser1/public_html<br />
[root@web01 ~]#chown -R sftpuser1 /home/chroot/home/sftpuser1/upload /home/chroot/home/sftpuser1/download /home/chroot/home/sftpuser1/public-html<br />
[root@web01 ~]#passwd sftpuser1</div></div>
<p>So user has full permissions only on these three folders. </p>
<p>The above commands created the &#8216;<strong>sftuser1</strong>&#8216; user which is a member of &#8216;<strong>sftp</strong>&#8221; group. Also  root user is take the ownership of users home directory. So that users can&#8217;t create/execute any command against on his home directory but can create any new files in it. My requirement is  to provide sftp space to a use who can upload and download files to a server securely.</p>
<p>Let&#8217;s start new ssh server.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@fc-db01 ~]# sh &nbsp;/etc/init.d/opensshd &nbsp;start</div></div>
<p>To verify it&#8217;s running,</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@fc-db01 ~]# netstat -nlp | grep &quot;:22222&quot;<br />
tcp &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 0.0.0.0:22222 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0.0.0.0:* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LISTEN &nbsp; &nbsp; &nbsp;24243/sftpserver<br />
tcp &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 :::22222 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:::* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LISTEN &nbsp; &nbsp; &nbsp;24243/sftpserver<br />
[root@fc-db01 ~]#</div></div>
<p>That&#8217;s it &#8211;> <img src='http://www.serveridol.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . Start sharing secure ftp space.  You also need to open the port 22222 which may require to update the your firewall/network rules.</p>
<blockquote><p>There is one imp. fix you will have to do.<br />
You need to add a line &#8220;DenyUsers sftpuser1&#8243; on your primary ssh server config file (<strong>/etc/ssh/sshd_config</strong>) which is running on the default port (<strong>22</strong>) and then restart the sshd service as well.</p></blockquote>
<p>NB: I see that you can access this ftp through Filezilla easily but Global scape FTP won&#8217;t  support to connect it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/03/10/linux-configuring-secure-sftp-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dovecot error : ERR Plaintext authentication disallowed on non-secure (SSL/TLS) connections</title>
		<link>http://www.serveridol.com/2012/03/01/dovecot-error-err-plaintext-authentication-disallowed-on-non-secure-ssltls-connections/</link>
		<comments>http://www.serveridol.com/2012/03/01/dovecot-error-err-plaintext-authentication-disallowed-on-non-secure-ssltls-connections/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 18:33:23 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[Dovecot]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1565</guid>
		<description><![CDATA[<p>You will see this error once after you configured sql based mail server based on my documentation and configure it&#8217;s account on any of MUA like Outlook or Thuderbird etc. </p> <p>Open Dovecot op3/IMAP config file and change the line to &#8220;disable_plaintext_auth = no&#8221;.</p> [root@mail ~]# vi /etc/dovecot/dovecot.conf [root@mail ~]# vi /etc/dovecot/conf.d/10-auth.conf [root@mail ~]# service [...]]]></description>
			<content:encoded><![CDATA[<p>You will see this error once after you configured sql based mail server based on my documentation and configure it&#8217;s account on any of MUA like Outlook or Thuderbird etc. </p>
<p>Open Dovecot op3/IMAP config file and change the line to &#8220;disable_plaintext_auth = no&#8221;.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@mail ~]# vi /etc/dovecot/dovecot.conf<br />
[root@mail ~]# vi /etc/dovecot/conf.d/10-auth.conf<br />
[root@mail ~]# service dovecot restart<br />
Stopping Dovecot Imap: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ &nbsp;OK &nbsp;]<br />
Starting Dovecot Imap: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ &nbsp;OK &nbsp;]<br />
[root@mail ~]# grep &quot;disable_plaintext_auth&quot; /etc/dovecot/conf.d/10-auth.conf<br />
disable_plaintext_auth = no<br />
# NOTE: See also disable_plaintext_auth setting.<br />
[root@mail ~]#</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/03/01/dovecot-error-err-plaintext-authentication-disallowed-on-non-secure-ssltls-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache : Skipping Basic auth from certain known ip&#8217;s/Network</title>
		<link>http://www.serveridol.com/2012/02/27/apache-skipping-basic-auth-from-known-ipsnetwork/</link>
		<comments>http://www.serveridol.com/2012/02/27/apache-skipping-basic-auth-from-known-ipsnetwork/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 13:34:52 +0000</pubDate>
		<dc:creator>Liju</dc:creator>
				<category><![CDATA[admins]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.serveridol.com/?p=1552</guid>
		<description><![CDATA[<p>Most of us don&#8217;t like to share access certain links/pages which containing some sensitive matters. So we need to setup a mechanism to limit this access of of this area. Apache have a password a authentication mechanism to limit the access to a location which commonly called &#8220;Basic authentication&#8220;. </p> <p>But this mechanism is quite [...]]]></description>
			<content:encoded><![CDATA[<p>Most of us don&#8217;t like to share access certain links/pages which containing some sensitive matters. So we need to setup a mechanism to limit this access of of this area. Apache have a password  a authentication mechanism to limit the access to a location which commonly called &#8220;<strong>Basic authentication</strong>&#8220;. </p>
<p>But this mechanism is quite annoying as it&#8217;s showing a popup to enter login details even though we access it from the office. To ellumincate this issue, we may place the auth in conjunction with network. So that Apache will not ask you logins if you are accessing from a network which know to Apache.</p>
<p>Here is the sample Apache entry to achieve this,</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Alias /openmydb /usr/share/pma<br />
&nbsp;&lt;Directory /usr/share/pma/&gt;<br />
&nbsp; &nbsp;Order Deny,Allow<br />
&nbsp; &nbsp;Deny from All<br />
&nbsp; &nbsp;Allow from localhost 127.0.0.0/8 ::1 64.39.0.0/24 64.39.2.144/28 64.39.4.132/30 64.39.0.64/28 <br />
<br />
&nbsp; &nbsp;AuthUserFile /etc/sec_passwords/htpasswd<br />
&nbsp; &nbsp;AuthName &quot;For authorized users&quot;<br />
&nbsp; &nbsp;AuthType Basic<br />
&nbsp; &nbsp;Require valid-user<br />
&nbsp; &nbsp;Satisfy any<br />
&lt;/Directory&gt;</div></div>
<p>Here <strong>allow</strong> directive open the access to listed IP&#8217;s. You may use CIDR to limit the no. of hosts to access. Pls note the text &#8220;<strong>Satisfy any</strong>&#8221;  did the magic. </p>
<p>Cheers .. it&#8217;s a smaller tip.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveridol.com/2012/02/27/apache-skipping-basic-auth-from-known-ipsnetwork/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

