<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7224500646953226549</id><updated>2024-08-31T23:04:49.285+05:30</updated><category term="CASifying Alfresco"/><category term="DOS Printing"/><category term="My IP keeps blocking in denyhosts."/><category term="PHP Fatal error:  Call to undefined function user_login_destination()"/><category term="Plesk qmail SMTP port 26"/><category term="apache infront of tomcat"/><category term="backup mysql automatically"/><category term="backup your website automatically"/><category term="drush"/><category term="git uses more space"/><title type='text'>GEO&#39;S VIEWS</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>332</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-6691554398251261620</id><published>2013-08-22T18:41:00.001+05:30</published><updated>2013-08-22T18:41:23.434+05:30</updated><title type='text'>Disable Gmail spam filter</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
When using Gmail App its a common problem in whcih legitimate mails/forwarded mail etc are going to SPAM folder. By this when using email clients, as anything caught by Gmail as SPAM is never downloaded and seen by the client. &lt;br /&gt;&lt;br /&gt;In Gmail there is no setting to turn it off the only option is creating email filter to pass mails to inbox: You can do the folling steps:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;Log into Gmail . Go to Settings&amp;gt;&amp;gt;Filters, and click on &quot;Create a new filter.&quot; In the &quot;Has the words&quot; field, enter &quot;&lt;b&gt;is:spam&lt;/b&gt;&quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;After clicking on &quot;Create filter with this search,&quot; continue to the next step by clicking &quot;OK.&quot;&amp;nbsp; You can Ignore the warning.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Choose the &quot;Never send it to Spam&quot; option, then click on &quot;Create filter.&quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;This&amp;nbsp; filter will allow all emails to hit the Inbox; Gmail&#39;s spam filter is rendered useless by this process, so your email client will have to take care of the incoming junk mail.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;a href=&quot;http://community.spiceworks.com/how_to/show/13963-disable-bypass-gmail-spam-filter&quot; target=&quot;_blank&quot;&gt;Reference&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/6691554398251261620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2013/08/disable-gmail-spam-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/6691554398251261620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/6691554398251261620'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2013/08/disable-gmail-spam-filter.html' title='Disable Gmail spam filter'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-223124862202602519</id><published>2013-01-31T14:05:00.004+05:30</published><updated>2013-01-31T14:09:13.990+05:30</updated><title type='text'>Setting Up Percona-xtrabackup</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Percona XtraBackup is the world&#39;s only open-source, free MySQL hot backup
software that performs non-blocking backups for InnoDB and XtraDB databases.
With Percona XtraBackup, you can achieve the following benefits:&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;Backups that complete quickly and reliably&lt;/li&gt;
&lt;li&gt;Uninterrupted transaction processing during backups&lt;/li&gt;
&lt;li&gt;Savings on disk space and network bandwidth&lt;/li&gt;
&lt;li&gt;Automatic backup verification&lt;/li&gt;
&lt;li&gt;Higher uptime due to faster restore time&lt;/li&gt;
&lt;/ul&gt;
&lt;a href=&quot;http://www.percona.com/software/percona-xtrabackup&quot; target=&quot;_blank&quot;&gt;Ref&lt;/a&gt;:&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;b&gt;Installation&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;&lt;code&gt;wget http://www.percona.com/redir/downloads/XtraBackup/XtraBackup-2.0.3/binary/Linux/x86_64/percona-xtrabackup-2.0.3-470.tar.gz

tar -zxvf percona-xtrabackup-2.0.3-470.tar.gz

cd percona-xtrabackup-2.0.3/bin

sudo cp * /usr/bin&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/223124862202602519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2013/01/setting-up-percona-xtrabackup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/223124862202602519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/223124862202602519'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2013/01/setting-up-percona-xtrabackup.html' title='Setting Up Percona-xtrabackup'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-1163372231899389196</id><published>2013-01-31T14:04:00.000+05:30</published><updated>2013-01-31T14:04:59.952+05:30</updated><title type='text'>Setting Up Percona-mysql-server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Percona apt Repository is not included in Base Ubuntu. So need to install it&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;sudo gpg --keyserver&amp;nbsp; hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;sudo gpg -a --export CD2EFD2A | sudo apt-key add -&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Add this to /etc/apt/sources.list, replacing VERSION with the name of your distribution:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;deb http://repo.percona.com/apt precise main&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;deb-src http://repo.percona.com/apt precise main&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;apt-get update&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc;&quot;&gt;apt-get install percona-server-server-5.5 percona-server-client-5.5&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Ref:http://www.percona.com/doc/percona-server/5.5/installation/apt_repo.html&lt;br /&gt;
Ref:http://www.percona.com/doc/percona-server/5.5/installation.html&lt;br /&gt;
&lt;br /&gt;
We can generate initial mysql configuration file (my.cnf) through the following link&lt;br /&gt;
https://tools.percona.com/wizard&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/1163372231899389196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2013/01/setting-up-percona-mysql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/1163372231899389196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/1163372231899389196'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2013/01/setting-up-percona-mysql-server.html' title='Setting Up Percona-mysql-server'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-2477236274104602338</id><published>2013-01-31T14:02:00.006+05:30</published><updated>2013-01-31T14:02:46.621+05:30</updated><title type='text'>VirtualBox Clone Root HD / Ubuntu / Network issue</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;br /&gt;When you clone a root Ubuntu disk in VirtualBox, one thing that gets messed up is the network card definition.&amp;nbsp; This is because Ubuntu (as it should) uses UDEV IDs for the network device.&amp;nbsp; When you boot your new disk, the network device ID has changed, so it creates a new eth1 device.&amp;nbsp; Unfortunately, this conflicts with the VirtualBox network setup.&amp;nbsp; What to do?&lt;br /&gt;&lt;br /&gt;Boot the box (no network)&lt;br /&gt;&lt;br /&gt;Edit the /etc/udev/rules.d/70-persistent-net.rules&lt;br /&gt;&lt;br /&gt;Delete the eth0 line and modify the eth1 line to be eth0&lt;br /&gt;&lt;br /&gt;--------- Example OLD -----------&lt;br /&gt;&lt;br /&gt;# This file was automatically generated by the /lib/udev/write_net_rules# program, run by the persistent-net-generator.rules rules file.## You can modify it, as long as you keep each rule on a single# line, and change only the value of the NAME= key.&lt;br /&gt;&lt;br /&gt;# PCI device 0x8086:0x100e (e1000)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;-------------------- br=&quot;&quot; delete=&quot;&quot; lines=&quot;&quot; these=&quot;&quot; two=&quot;&quot;&gt;SUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;08:00:27:d8:8d:15&quot;, ATTR{dev_id}==&quot;0x0&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth0&quot;&lt;br /&gt;&lt;br /&gt;# PCI device 0x8086:0x100e (e1000)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---Modify the next line and change eth1 to be eth0&lt;br /&gt;SUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;08:00:27:89:84:98&quot;, ATTR{dev_id}==&quot;0x0&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth1&quot;&lt;br /&gt;&lt;br /&gt;----------------------------------------&lt;br /&gt;&lt;br /&gt;--------- Example NEW -----------&lt;br /&gt;&lt;br /&gt;# This file was automatically generated by the /lib/udev/write_net_rules# program, run by the persistent-net-generator.rules rules file.## You can modify it, as long as you keep each rule on a single# line, and change only the value of the NAME= key.&lt;br /&gt;&lt;br /&gt;# PCI device 0x8086:0x100e (e1000)&lt;br /&gt;SUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;08:00:27:89:84:98&quot;, ATTR{dev_id}==&quot;0x0&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth0&quot;&lt;br /&gt;&lt;br /&gt;----------------------------------------&lt;br /&gt;&lt;a href=&quot;https://blogs.oracle.com/johngraves/entry/virtualbox_clone_root_hd_ubuntu_network_issue&quot; target=&quot;_blank&quot;&gt;Reference&lt;/a&gt;: &lt;br /&gt;&lt;/--------------------&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/2477236274104602338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2013/01/virtualbox-clone-root-hd-ubuntu-network.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2477236274104602338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2477236274104602338'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2013/01/virtualbox-clone-root-hd-ubuntu-network.html' title='VirtualBox Clone Root HD / Ubuntu / Network issue'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-7851142458206285555</id><published>2013-01-31T14:00:00.002+05:30</published><updated>2013-01-31T14:00:22.174+05:30</updated><title type='text'>Image cache issue in drupal with nginx</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;Resolved it by adding the following in nginx virtual host file:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; location ^~ /sites/default/files/imagecache/ {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index&amp;nbsp; index.php index.html;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!-e $request_filename) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rewrite&amp;nbsp; ^/(.*)$&amp;nbsp; /index.php?q=$1&amp;nbsp; last;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/blockquote&gt;
&lt;br /&gt;The above assumes that your imagecache files are to be stored in sites/default/files/imagecache&lt;br /&gt;Instead of nginx serving the static content (the jpeg or png or whatever) to the browser it will instead rewrite the path to (invisibly): index.php?q=sites/default/files...&lt;br /&gt;This allows imagecache to run its manipulations on the file.&lt;br /&gt;Just make sure you alter the location directive to match whatever path your imagecache files are in (relative to site root) and you should be fine.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://drupal.org/node/385690&quot; target=&quot;_blank&quot;&gt;Reference&lt;/a&gt;: &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/7851142458206285555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2013/01/image-cache-issue-in-drupal-with-nginx.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7851142458206285555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7851142458206285555'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2013/01/image-cache-issue-in-drupal-with-nginx.html' title='Image cache issue in drupal with nginx'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-7287733371192605264</id><published>2012-08-16T10:18:00.003+05:30</published><updated>2012-08-16T10:19:28.890+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="My IP keeps blocking in denyhosts."/><title type='text'>How To Delete/Remove Blocked IP From DenyHosts</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #232323; font-family: Georgia; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.5; margin: 14px 0px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
1. First you need to stop&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Denyhosts&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;service, by following command.&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #fafafa; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(229, 229, 229); color: #2e2e2e; font-family: &#39;Courier New&#39;, Monaco, &#39;Nimbus Mono L&#39;, monospace; font-size: small; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 19px; margin: 10px 0px; orphans: 2; overflow: hidden; padding: 15px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre-wrap; widows: 2; word-spacing: 0px;&quot;&gt;[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/etc/init.d/denyhosts stop&lt;/b&gt;
&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #232323; font-family: Georgia; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.5; margin: 14px 0px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
2. Next open file&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/etc/hosts.deny&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;with below command.&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #fafafa; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(229, 229, 229); color: #2e2e2e; font-family: &#39;Courier New&#39;, Monaco, &#39;Nimbus Mono L&#39;, monospace; font-size: small; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 19px; margin: 10px 0px; orphans: 2; overflow: hidden; padding: 15px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre-wrap; widows: 2; word-spacing: 0px;&quot;&gt;[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;vi /etc/hosts.deny&lt;/b&gt;
&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #232323; font-family: Georgia; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.5; margin: 14px 0px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
3. Delete blocked&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;IP&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;address, then save and close above file.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px none; color: #232323; font-family: Georgia; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.5; margin: 14px 0px; orphans: 2; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
4. Now go to directory called&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/usr/share/denyhosts/data or /var/lib/denyhosts&lt;/b&gt;&lt;b&gt;&lt;/b&gt;/&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #fafafa; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(229, 229, 229); color: #2e2e2e; font-family: &#39;Courier New&#39;, Monaco, &#39;Nimbus Mono L&#39;, monospace; font-size: small; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 19px; margin: 10px 0px; orphans: 2; overflow: hidden; padding: 15px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre-wrap; widows: 2; word-spacing: 0px;&quot;&gt;[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;cd /usr/share/denyhosts/data&lt;/b&gt;
&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #232323; font-family: Georgia; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.5; margin: 14px 0px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
5. Next you need to delete blocked&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;IP&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;from all below following files with help of&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;vi&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;editor.&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #fafafa; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(229, 229, 229); color: #2e2e2e; font-family: &#39;Courier New&#39;, Monaco, &#39;Nimbus Mono L&#39;, monospace; font-size: small; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 19px; margin: 10px 0px; orphans: 2; overflow: hidden; padding: 15px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre-wrap; widows: 2; word-spacing: 0px;&quot;&gt;[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;vi hosts&lt;/b&gt;
[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;vi hosts-restricted&lt;/b&gt;
[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;vi hosts-root&lt;/b&gt;
[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;vi hosts-valid&lt;/b&gt;
[root@geopc ~]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;vi users-hosts&lt;/b&gt;
&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #232323; font-family: Georgia; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.5; margin: 14px 0px; orphans: 2; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
6. Once you removed your blocked&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;IP&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;from all above files, then start&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Denyhosts&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;service.&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #fafafa; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(229, 229, 229); color: #2e2e2e; font-family: &#39;Courier New&#39;, Monaco, &#39;Nimbus Mono L&#39;, monospace; font-size: small; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 19px; margin: 10px 0px; orphans: 2; overflow: hidden; padding: 15px; text-align: start; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: pre-wrap; widows: 2; word-spacing: 0px;&quot;&gt;[root@geopc data]# &lt;b style=&quot;background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: 0px; font-weight: 700; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/etc/init.d/denyhosts start&lt;/b&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/7287733371192605264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/08/how-to-deleteremove-blocked-ip-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7287733371192605264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7287733371192605264'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/08/how-to-deleteremove-blocked-ip-from.html' title='How To Delete/Remove Blocked IP From DenyHosts'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-2198153099937557980</id><published>2012-07-26T09:57:00.000+05:30</published><updated>2012-08-14T09:29:03.797+05:30</updated><title type='text'>Connecting to a MySQL server from a different server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1 style=&quot;background-color: white; color: black; font-family: Tahoma,Calibri,Verdana,Geneva,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

&lt;a href=&quot;http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html&quot; target=&quot;_blank&quot;&gt;&lt;span class=&quot;threadtitle&quot;&gt;Connecting to a MySQL server from a different domain&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;h1 style=&quot;background-color: white; color: black; font-family: Tahoma,Calibri,Verdana,Geneva,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

&lt;span class=&quot;threadtitle&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step # 1: Login Using SSH (if server is outside your data center)&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
First, login over ssh to remote MySQL database server:&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step # 2: Edit my.cnf File&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Once connected you need to edit the MySQL server configuration file my.cnf using a text editor such as vi.&lt;/div&gt;
&lt;ul style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; list-style: square; margin: 0px 0px 1.571em 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;If you are using&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;Debian Linux&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;file is located at /etc/mysql/my.cnf location&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;If you are using&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;Red Hat Linux/Fedora/Centos Linux&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;file is located at /etc/my.cnf location&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;If you are using&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;FreeBSD&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;you need to create a file /var/db/mysql/my.cnf&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Edit /etc/my.cnf, run:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;# vi /etc/my.cnf&lt;/code&gt;&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step # 3: Once file opened, locate line that read as follows&lt;/h3&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;[mysqld] &lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Make sure line skip-networking is commented (or remove line) and add following line&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;bind-address=YOUR-SERVER-IP&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
For example, if your MySQL server IP is 65.55.55.2 then entire block should be look like as follows:&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
language        = /usr/share/mysql/English
bind-address    = 65.55.55.2
# skip-networking
....
..
....&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Where,&lt;/div&gt;
&lt;ul style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; list-style: square; margin: 0px 0px 1.571em 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;bind-address&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;: IP address to bind to.&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;skip-networking&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;: Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should be removed from my.cnf or put it in comment state.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step# 4 Save and Close the file&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
If you are using Debian / Ubuntu Linux, type the following command to restart the mysql server:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;# /etc/init.d/mysql restart&lt;/code&gt;&lt;br /&gt;
If you are using RHEL / CentOS / Fedora / Scientific Linux, type the following command to restart the mysql server:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;# /etc/init.d/mysqld restart&lt;/code&gt;&lt;br /&gt;
If you are using FreeBSD, type the following command to restart the mysql server:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;# /usr/local/etc/rc.d/mysql-server stop&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;# /usr/local/etc/rc.d/mysql-server start&lt;/code&gt;&lt;br /&gt;
OR&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;# /usr/local/etc/rc.d/mysql-server restart&lt;/code&gt;&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step # 5 Grant access to remote IP address&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Connect to mysql server:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;$ mysql -u root -p mysql&lt;/code&gt;&lt;/div&gt;
&lt;h4 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 22px; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Grant access to a new database&lt;/h4&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
If you want to add a new database called foo for user bar and remote IP 202.54.10.20 then you need to type the following commands at mysql&amp;gt; prompt:&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;mysql&amp;gt; CREATE DATABASE foo;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;mysql&amp;gt; GRANT ALL ON foo.* TO bar@&#39;202.51.10.20&#39; IDENTIFIED BY &#39;PASSWORD&#39;;&lt;/code&gt;&lt;/div&gt;
&lt;h4 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 22px; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

How Do I Grant Access To An Existing Database?&lt;/h4&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Let us assume that you are always making connection from remote IP called 202.54.10.20 for database called webdb for user webadmin, To grant access to this IP address type the following command At mysql&amp;gt; prompt for existing database, enter:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;mysql&amp;gt; update db set Host=&#39;202.54.10.20&#39; where Db=&#39;webdb&#39;;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;mysql&amp;gt; update user set Host=&#39;202.54.10.20&#39; where user=&#39;webadmin&#39;;&lt;/code&gt;&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step # 6: Logout of MySQL&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Type exit command to logout mysql:&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;mysql&amp;gt; exit&lt;/code&gt;&lt;/div&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step # 7: Open port 3306&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
You need to open TCP port 3306 using iptables or BSD pf firewall.&lt;/div&gt;
&lt;h4 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 22px; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

A sample iptables rule to open Linux iptables firewall&lt;/h4&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
OR only allow remote connection from your web server located at 10.5.1.3:&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;/sbin/iptables -A INPUT -i eth0 -s 10.5.1.3 -p tcp --destination-port 3306 -j ACCEPT&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
OR only allow remote connection from your lan subnet 192.168.1.0/24:&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;/sbin/iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp --destination-port 3306 -j ACCEPT&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Finally save all rules (RHEL / CentOS specific command):&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;# service iptables save&lt;/code&gt;&lt;/div&gt;
&lt;h4 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 22px; margin: 0px; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

A sample FreeBSD / OpenBSD pf rule ( /etc/pf.conf)&lt;/h4&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;pass in on $ext_if proto tcp from any to any port 3306&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
OR allow only access from your web server located at 10.5.1.3:&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;pass in on $ext_if proto tcp from 10.5.1.3 to any port 3306  flags S/SA synproxy state&lt;/pre&gt;
&lt;h3 style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 1.286em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 1.833em 0px 0.611em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

Step # 8: Test it&lt;/h3&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
From your remote system or your desktop type the following command:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;$ mysql -u webadmin –h 65.55.55.2 –p&lt;/code&gt;&lt;br /&gt;
Where,&lt;/div&gt;
&lt;ul style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; list-style: square; margin: 0px 0px 1.571em 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;-u webadmin: webadmin is MySQL username&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;-h IP or hostname: 65.55.55.2 is MySQL server IP address or hostname (FQDN)&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;-p : Prompt for password&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #111111; font-family: Arial, &#39;Helvetica Neue&#39;, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 22px; margin: 0px 0px 1.571em; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
You can also use the telnet or nc command to connect to port 3306 for testing purpose:&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;$ echo X | telnet -e X 65.55.55.2 3306&lt;/code&gt;&lt;br /&gt;
OR&lt;br /&gt;
&lt;code style=&quot;background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;&quot;&gt;$ nc -z -w1 65.55.55.2 3306&lt;/code&gt;&lt;br /&gt;
Sample outputs:&lt;/div&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #eeeeee; background-position: initial initial; background-repeat: initial initial; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 0.857em; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 1.833em; orphans: 2; overflow: auto; padding: 0.667em 0.917em; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;Connection to 65.55.55.2 3306 port [tcp/mysql] succeeded!&lt;/pre&gt;
&lt;h1 style=&quot;background-color: white; color: black; font-family: Tahoma,Calibri,Verdana,Geneva,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

&lt;span class=&quot;threadtitle&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
&lt;h1 style=&quot;background-color: white; color: black; font-family: Tahoma,Calibri,Verdana,Geneva,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

&lt;span class=&quot;threadtitle&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
&lt;h1 style=&quot;background-color: white; color: black; font-family: Tahoma,Calibri,Verdana,Geneva,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;

&lt;span class=&quot;threadtitle&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/2198153099937557980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/07/connecting-to-mysql-server-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2198153099937557980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2198153099937557980'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/07/connecting-to-mysql-server-from.html' title='Connecting to a MySQL server from a different server'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-7170677006808233490</id><published>2012-04-18T10:30:00.000+05:30</published><updated>2012-04-18T10:30:59.203+05:30</updated><title type='text'>Access Your MySQL Server Remotely Over SSH</title><content type='html'>Access Your MySQL Server Remotely Over SSH&lt;br /&gt;
&lt;br /&gt;
So you’ve got MySQL on your web server, but it’s only opened to local ports by default for security reasons. If you want to access your database from a client tool like the MySQL Query Browser, normally you’d have to open up access from your local IP address… but that’s not nearly as secure.&lt;br /&gt;
&lt;br /&gt;
So instead, we’ll just use port-forwarding through an SSH tunnel, so your MySQL client thinks it’s connecting to your localhost machine, but it’s really connecting to the other server through the tunnel.&lt;br /&gt;
&lt;br /&gt;
You will need the following software:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Putty&lt;/b&gt;:&lt;br /&gt;
You can download putty from the url: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html&lt;br /&gt;
&lt;br /&gt;
Run the downloaded putty.exe file. You will get a window like this and enter the Hostname or IP Address.&lt;br /&gt;
&lt;br /&gt;
For eg:&lt;br /&gt;
Hostname or IP Address: 10.5.7.51&lt;br /&gt;
&lt;br /&gt;
Now click open&lt;br /&gt;
&lt;br /&gt;
You will get a session and for saving that session right click on windows and take Change Settings as shown below:&lt;br /&gt;
&lt;br /&gt;
Below Saved Sessions enter any name for eg: mysql-ssh and click on save. &lt;br /&gt;
&lt;br /&gt;
Now again take putty and click on whichever connection name you wish to use for the secure tunnel.&lt;br /&gt;
&lt;br /&gt;
Click &quot;Load&quot;&lt;br /&gt;
Go to Connection &gt; SSH &gt; Tunnels&lt;br /&gt;
&lt;br /&gt;
Enter MySQL connection information&lt;br /&gt;
&lt;br /&gt;
The &quot;Source port&quot; is the local port your MySQL Administrator will connect to instead of the remote (server) port it normally would. This can be any port and we can use .&lt;br /&gt;
The &quot;Desitination&quot; is the address and port of your actual MySQL Server. But since your SSH connection will be considered &quot;local&quot; to your MySQL Server, you should use either &quot;127.0.0.1&quot; or &quot;localhost&quot; depending on what works best. Then specify your mysql port so that Destination will be as follows:&lt;br /&gt;
&lt;br /&gt;
127.0.0.1:3306&lt;br /&gt;
&lt;br /&gt;
Make sure the information in &quot;Source port&quot; and &quot;Destination&quot; are correct, that the &quot;Local&quot; radio button is selected and click &quot;Add&quot;.&lt;br /&gt;
&lt;br /&gt;
You should now see the new tunnel information displayed as shown.&lt;br /&gt;
&lt;br /&gt;
Go back to the main Putty screen and save the connection.&lt;br /&gt;
&lt;br /&gt;
Now you can open ssh session by entering the user name and password. &lt;br /&gt;
&lt;br /&gt;
Once you’ve got the ssh tunnel going, you can open up any mysql client and enter in the details for your remote server.&lt;br /&gt;
&lt;br /&gt;
Since your connection will now be through the secure tunnel created by Putty, your &quot;Server Host&quot; will now be local so use &quot;127.0.0.1&quot;.&lt;br /&gt;
&lt;br /&gt;
The &quot;Port&quot; should be set to the same port you set for Source port earlier.&lt;br /&gt;
&lt;br /&gt;
Once the connection settings are correct, click &quot;OK&quot; and you should then be able to succesfully connect to your MySQL server except now, through a secure tunnel!</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/7170677006808233490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/access-your-mysql-server-remotely-over.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7170677006808233490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7170677006808233490'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/access-your-mysql-server-remotely-over.html' title='Access Your MySQL Server Remotely Over SSH'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-889836090663142945</id><published>2012-04-05T12:05:00.002+05:30</published><updated>2012-04-05T12:05:37.086+05:30</updated><title type='text'>SSH Key Generation and its Fingerprint Verification</title><content type='html'>SSH Key Generation and its Fingerprint.&lt;br /&gt;
&lt;br /&gt;
Generate a new SSH key. &lt;br /&gt;
&lt;br /&gt;
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.&lt;br /&gt;
&lt;br /&gt;
   &lt;blockquote&gt;$ ssh-keygen -t rsa -C &quot;your_email@youremail.com&quot;&lt;/blockquote&gt;&lt;br /&gt;
Creates a new ssh key using the provided email&lt;br /&gt;
Generating public/private rsa key pair.&lt;br /&gt;
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):&lt;press enter&gt;&lt;br /&gt;
&lt;br /&gt;
Now you need to enter a passphrase.&lt;br /&gt;
&lt;br /&gt;
To view the fingerprint of the ssh host key&lt;br /&gt;
&lt;br /&gt;
    &lt;blockquote&gt;ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/889836090663142945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/ssh-key-generation-and-its-fingerprint.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/889836090663142945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/889836090663142945'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/ssh-key-generation-and-its-fingerprint.html' title='SSH Key Generation and its Fingerprint Verification'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-8624982797713829967</id><published>2012-04-05T12:04:00.002+05:30</published><updated>2012-04-05T12:04:27.186+05:30</updated><title type='text'>Apache Tomcat Installation and SSL Configuration</title><content type='html'>You can see/download latest versions of tomcat from the url: http://tomcat.apache.org/whichversion.html&lt;br /&gt;
&lt;br /&gt;
To download and install Apache Tomcat version 7.0.26&lt;br /&gt;
&lt;br /&gt;
    cd /opt    &lt;br /&gt;
    wget http://apache.petsads.us/tomcat/tomcat-7/v7.0.26/bin/apache-tomcat-7.0.26.tar.gz&lt;br /&gt;
    tar -xvf apache-tomcat-7.0.26.tar.gz /opt&lt;br /&gt;
&lt;br /&gt;
Now set variables in server.&lt;br /&gt;
&lt;br /&gt;
    vi /root/.bashrc&lt;br /&gt;
&lt;br /&gt;
Copy and paste below lines:&lt;br /&gt;
&lt;br /&gt;
&gt; export CATALINA_HOME=/opt/apache-tomcat-7.0.26&lt;br /&gt;
&lt;br /&gt;
&gt; export TOMCAT_HOME=$CATALINA_HOME&lt;br /&gt;
&lt;br /&gt;
&gt; export PATH=$CATALINA_HOME/bin:$PATH&lt;br /&gt;
&lt;br /&gt;
Logout and Login to server.&lt;br /&gt;
&lt;br /&gt;
**Configure SSL for tomcat**&lt;br /&gt;
&lt;br /&gt;
Use below command to create the keystore and while creating use hostname for &quot;first and last name&quot;&lt;br /&gt;
&lt;br /&gt;
    keytool -genkey -alias tomcat -keyalg RSA -keystore /opt/keystore&lt;br /&gt;
&lt;br /&gt;
Edit server.xml file and uncommented/edited these lines:&lt;br /&gt;
&lt;br /&gt;
    &lt;Connector port=&quot;8443&quot; protocol=&quot;HTTP/1.1&quot; SSLEnabled=&quot;true&quot;
               maxThreads=&quot;150&quot; scheme=&quot;https&quot; secure=&quot;true&quot;
               clientAuth=&quot;false&quot; sslProtocol=&quot;TLS&quot; 
               keystoreFile=&quot;/opt/keystore&quot;               keystorePass=&quot;password&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Note: change password as while you are creating the keystore&lt;br /&gt;
&lt;br /&gt;
Restart tomcat&lt;br /&gt;
&lt;br /&gt;
    catalina.sh stop&lt;br /&gt;
    catalina.sh start</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/8624982797713829967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/apache-tomcat-installation-and-ssl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/8624982797713829967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/8624982797713829967'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/apache-tomcat-installation-and-ssl.html' title='Apache Tomcat Installation and SSL Configuration'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-2577152419620335092</id><published>2012-04-05T11:48:00.001+05:30</published><updated>2012-04-05T11:49:11.670+05:30</updated><title type='text'>Some useful commands to Manage/Monitor Servers</title><content type='html'>These commands are mainly for rpm based linux servers like CentOS etc.. May be some commands works in ubuntu servers etc...&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Command to find out total established connections, closing connection, TIME_WAIT and much more.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;netstat -nat | awk &#39;{print $6}&#39; | sort | uniq -c | sort -n&lt;/blockquote&gt;&lt;br /&gt;
Sample Output:&lt;br /&gt;
&lt;br /&gt;
1 established&lt;br /&gt;
1 Foreign&lt;br /&gt;
5 LISTEN&lt;br /&gt;
16 TIME_WAIT&lt;br /&gt;
19 ESTABLISHED&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dig out more information about a specific ip address&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;netstat -nat |grep {IP-address} | awk &#39;{print $6}&#39; | sort | uniq -c | sort -n&lt;/blockquote&gt;&lt;br /&gt;
2 LISTEN&lt;br /&gt;
4 FIN_WAIT1&lt;br /&gt;
4 ESTABLISHED&lt;br /&gt;
7 TIME_WAIT&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;To print list of all unique IP address connected to server, enter:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;netstat -nat | awk &#39;{ print $5}&#39; | cut -d: -f1 | sed -e &#39;/^$/d&#39; | uniq&lt;/blockquote&gt;&lt;b&gt;&lt;br /&gt;
To print total of all unique IP address, enter:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;netstat -nat | awk &#39;{ print $5}&#39; | cut -d: -f1 | sed -e &#39;/^$/d&#39; | uniq | wc -l&lt;/blockquote&gt;&lt;b&gt;&lt;br /&gt;
Find Out If Box is Under DoS Attack or Not&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you think your Linux box is under attack, print out a list of open connections on your box and sorts them by according to IP address, enter:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;netstat -atun | awk &#39;{print $5}&#39; | cut -d: -f1 | sed -e &#39;/^$/d&#39; |sort | uniq -c | sort -n&lt;/blockquote&gt;&lt;b&gt;&lt;br /&gt;
Command to list the connections to port 80:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;netstat -alntp | grep :80&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;To check the number of connections to port 80:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;netstat -alntp | grep :80 | wc -l&lt;/blockquote&gt;&lt;b&gt;&lt;br /&gt;
Command To Find Out Top 10 CPU Consuming Process&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;ps -auxf | sort -nr -k 3 | head -10&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;Command To Find Out The Top 10 Memory Consuming Process&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;ps -auxf | sort -nr -k 4 | head -10&lt;br /&gt;
&lt;/blockquote&gt;&lt;b&gt;An useful command to list connections to a particular port with its proccess id.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For eg: Port 8080&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;lsof -w -n -i tcp:8080&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;Command to remove a running process.&lt;/b&gt;&lt;br /&gt;
For eg: a proccess with PID 8457&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;kill -9 8457&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;Linux Screen Command&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Steps&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
- Create a screen using the command&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;screen -S geopc&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
- Close the shell without logout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
- Open a new shell and type &lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;screen -ls&lt;/blockquote&gt;&lt;br /&gt;
Sample Output:&lt;br /&gt;
&lt;br /&gt;
There are screens on:&lt;br /&gt;
16921.joemon (Dead ???)&lt;br /&gt;
3981.name (Attached)&lt;br /&gt;
5002.geopc (Attached)&lt;br /&gt;
Remove dead screens with &#39;screen -wipe&#39;.&lt;br /&gt;
3 Sockets in /tmp/screens/S-root.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
- You can login to that screen using the command screen -r &#39;screen name&#39;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;screen -r 5002.geopc&lt;/blockquote&gt;&lt;br /&gt;
To attach a scree that is already attached with the following command:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;screen -x -R&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
You can add your commands as comments!... :)</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/2577152419620335092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/some-useful-commands-to-managemonitor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2577152419620335092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2577152419620335092'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/some-useful-commands-to-managemonitor.html' title='Some useful commands to Manage/Monitor Servers'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-5696407885559389179</id><published>2012-04-05T11:37:00.000+05:30</published><updated>2012-04-05T11:37:14.949+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="apache infront of tomcat"/><title type='text'>Setting up Apache Tomcat to work with Apache Server</title><content type='html'>We are using **mod_jk** Tomcat-Apache plug-in that handles the communication between Tomcat and Apache.&lt;br /&gt;
&lt;br /&gt;
Install the GNU compilers gcc and g++, make utility to maintain groups of programs and httpd-devel package with the following command in rpm based linux.&lt;br /&gt;
&lt;br /&gt;
 yum install gcc* gcc-c++ make automake httpd-devel &lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
Installation and configuration&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ensure Apache HTTP Server is not running&lt;br /&gt;
 &lt;br /&gt;
 /etc/init.d/httpd stop&lt;br /&gt;
&lt;br /&gt;
Download and extract Tomcat Connector to the following under /root&lt;br /&gt;
&lt;br /&gt;
 cd /root/&lt;br /&gt;
 wget http://mirrors.kahuki.com/apache//tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.32-src.tar.gz&lt;br /&gt;
 tar -xvf tomcat-connectors-1.2.32-src.tar.gz&lt;br /&gt;
 cd /root/tomcat-connectors-1.2.32-src/native/&lt;br /&gt;
&lt;br /&gt;
Build and install with the following command&lt;br /&gt;
&lt;br /&gt;
 ./configure --with-apxs=/usr/sbin/apxs; make; make install&lt;br /&gt;
&lt;br /&gt;
Change permission of loaded module mod_jk.so&lt;br /&gt;
&lt;br /&gt;
 chmod 755 /usr/lib64/httpd/modules/mod_jk.so&lt;br /&gt;
&lt;br /&gt;
Create mod_jk.conf file in apache httpd server.&lt;br /&gt;
&lt;br /&gt;
 vi /etc/httpd/conf.d/mod_jk.conf&lt;br /&gt;
&lt;br /&gt;
Copy and paste below lines.&lt;br /&gt;
&lt;br /&gt;
 &lt;IfModule !mod_jk.c&gt;&lt;br /&gt;
   LoadModule jk_module &quot;/usr/lib64/httpd/modules/mod_jk.so&quot;&lt;br /&gt;
 &lt;/IfModule&gt;&lt;br /&gt;
 &lt;br /&gt;
 JkWorkersFile &quot;/opt/apache-tomcat-6.0.20/conf/jk/workers.properties&quot;&lt;br /&gt;
 JkLogFile &quot;/opt/apache-tomcat-6.0.20/logs/mod_jk.log&quot;&lt;br /&gt;
 &lt;br /&gt;
 JkLogLevel emerg&lt;br /&gt;
&lt;br /&gt;
Open workers.properties file in apache tomcat.&lt;br /&gt;
&lt;br /&gt;
 vi /opt/tomcat/conf/jk/workers.properties&lt;br /&gt;
&lt;br /&gt;
Add ajp13 to workers.list so that the following line becomes:&lt;br /&gt;
&lt;br /&gt;
 worker.list=jk-status, ajp13&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In mod_jk.conf and ssl.conf use mod_jk&#39;s JkMount directive to assign specific URLs to Tomcat. For example the following directives will send all requests beginning with /idp to the &quot;ajp13&quot; worker.&lt;br /&gt;
&lt;br /&gt;
Open mod_jk.conf in apache server.&lt;br /&gt;
&lt;br /&gt;
 vi /etc/httpd/conf.d/mod_jk.conf&lt;br /&gt;
&lt;br /&gt;
Copy and paste below lines at the end of file.&lt;br /&gt;
&lt;br /&gt;
 JkMount /idp ajp13&lt;br /&gt;
 JkMount /idp/* ajp13&lt;br /&gt;
&lt;br /&gt;
Now open ssl.conf file to setup redirection for secure connection&lt;br /&gt;
&lt;br /&gt;
 vi /etc/httpd/conf.d/ssl.conf&lt;br /&gt;
&lt;br /&gt;
Configure mod_ssl by adding the following lines near the end, just before the closing &lt;/VirtualHost&gt;.&lt;br /&gt;
&lt;br /&gt;
 JkMount /idp ajp13&lt;br /&gt;
 JkMount /idp/* ajp13&lt;br /&gt;
&lt;br /&gt;
Restart tomcat and apache&lt;br /&gt;
&lt;br /&gt;
 catalina.sh stop&lt;br /&gt;
 catalina.sh start&lt;br /&gt;
 /etc/init.d/httpd restart&lt;br /&gt;
 &lt;br /&gt;
Thats all!...&lt;br /&gt;
&lt;br /&gt;
The main advantage of this is you need to open only port of apache in firewall.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/5696407885559389179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/setting-up-apache-tomcat-to-work-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/5696407885559389179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/5696407885559389179'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/setting-up-apache-tomcat-to-work-with.html' title='Setting up Apache Tomcat to work with Apache Server'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-3375547677807131264</id><published>2012-04-05T11:30:00.000+05:30</published><updated>2012-04-05T11:30:48.207+05:30</updated><title type='text'>Apache Maven Installation and Configuration</title><content type='html'>Apache Maven Installation and Configuration&lt;br /&gt;
&lt;br /&gt;
You can see/download latest versions of tomcat from the url: http://maven.apache.org/download.html&lt;br /&gt;
&lt;br /&gt;
To download and install Apache Maven-2.2.1&lt;br /&gt;
&lt;br /&gt;
    &lt;blockquote&gt;cd /opt&lt;br /&gt;
    wget http://apache.mirrors.redwire.net//maven/binaries/apache-maven-2.2.1-bin.tar.gz&lt;br /&gt;
    tar -xvf apache-maven-2.2.1-bin.tar.gz&lt;/blockquote&gt;&lt;br /&gt;
Now set variables in server.&lt;br /&gt;
&lt;br /&gt;
   &lt;blockquote&gt;vi /root/.bashrc&lt;/blockquote&gt;&lt;br /&gt;
Copy and paste below lines:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&gt; export MVN_HOME=/opt/apache-maven-2.2.1&lt;br /&gt;
&lt;br /&gt;
&gt; export PATH=$MVN_HOME/bin:$PATH&lt;/blockquote&gt;&lt;br /&gt;
Logout and Login to server.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/3375547677807131264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/apache-maven-installation-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/3375547677807131264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/3375547677807131264'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/apache-maven-installation-and.html' title='Apache Maven Installation and Configuration'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-9144490391455136221</id><published>2012-04-05T10:53:00.002+05:30</published><updated>2012-04-05T10:53:14.264+05:30</updated><title type='text'>Installation of JAVA</title><content type='html'>Java&lt;br /&gt;
&lt;br /&gt;
You can down load Java from the url: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html&lt;br /&gt;
&lt;br /&gt;
or for a linux with 62 bit OS&lt;br /&gt;
&lt;br /&gt;
    wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-x64.bin&lt;br /&gt;
&lt;br /&gt;
Now install java as follows:&lt;br /&gt;
&lt;br /&gt;
    mkdir cd /usr/java/&lt;br /&gt;
    mv jdk-6u31-linux-x64.bin /usr/java/&lt;br /&gt;
    cd /usr/java&lt;br /&gt;
    chmod +x jdk-6u31-linux-x64.bin&lt;br /&gt;
    ./jdk-6u31-linux-x64.bin&lt;br /&gt;
&lt;br /&gt;
Now set java variables in server.&lt;br /&gt;
&lt;br /&gt;
    vi /root/.bashrc&lt;br /&gt;
&lt;br /&gt;
Copy and paste below lines:&lt;br /&gt;
&lt;br /&gt;
&gt; export JAVA_HOME=/usr/java/jdk1.6.0_29&lt;br /&gt;
&gt; export PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;
&lt;br /&gt;
Logout and Login again.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/9144490391455136221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/installation-of-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/9144490391455136221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/9144490391455136221'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/installation-of-java.html' title='Installation of JAVA'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-6092032556446444583</id><published>2012-04-05T10:50:00.000+05:30</published><updated>2012-04-05T10:50:07.945+05:30</updated><title type='text'>html to pdf conversion in Linux</title><content type='html'>To convert html page or an url to pdf, we can use wkhtmltopdf on a linux machine.&lt;br /&gt;
&lt;br /&gt;
Downloaded the relevant static binary v0.10.0 from here: http://code.google.com/p/wkhtmltopdf/downloads/list&lt;br /&gt;
&lt;br /&gt;
via ssh on my shared host typed the following:&lt;br /&gt;
&lt;br /&gt;
    &lt;blockquote&gt;wget {relavant url to binary from link above}&lt;br /&gt;
    tar -xvf {filename of above wget&#39;d file}&lt;/blockquote&gt;For eg: for a 64 bit OS&lt;br /&gt;
&lt;br /&gt;
    &lt;blockquote&gt;wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2&lt;br /&gt;
    tar -jxvf wkhtmltopdf-0.9.9-static-amd64.tar.bz2&lt;br /&gt;
    cp -rv wkhtmltopdf-amd64 /usr/local/bin/&lt;/blockquote&gt;&lt;br /&gt;
Now you can convert pages as follows:&lt;br /&gt;
&lt;br /&gt;
    &lt;blockquote&gt;wkhtmltopdf-amd64 http://www.google.com google.pdf&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/6092032556446444583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/04/html-to-pdf-conversion-in-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/6092032556446444583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/6092032556446444583'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/04/html-to-pdf-conversion-in-linux.html' title='html to pdf conversion in Linux'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-7328931973353812376</id><published>2012-03-06T11:42:00.001+05:30</published><updated>2012-03-06T11:53:24.913+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="git uses more space"/><title type='text'>Managing .git file size</title><content type='html'>&lt;b&gt;Managing .git file size&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
While using the main problem we will be facing is large size of .git folder inside your repository. Follow below commands from your repository for the best way to cut down the size with out effecting the commit history:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;# git reflog expire --expire=0 –all&lt;br /&gt;
# git repack –ad&lt;br /&gt;
# git prune &lt;br /&gt;
# git gc&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Reflog &lt;/b&gt;is a mechanism to record when the tip of branches are updated. This command is to manage the information recorded in it. The subcommand &quot;expire&quot; is used to prune older reflog entries. Entries older than expire time, or entries older than expire-unreachable time and not reachable from the current tip, are removed from the reflog.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Repack &lt;/b&gt;is used to combine all objects that do not currently reside in a &quot;pack&quot;, into a pack. It can also be used to re-organize existing packs into a single, more efficient pack.A pack is a collection of objects, individually compressed, with delta compression applied, stored in a single file, with an associated index file.Packs are used to reduce the load on mirror systems, backup engines, disk storage, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Prune &lt;/b&gt;- Prune all unreachable objects from the object database.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;GC &lt;/b&gt;Cleanup unnecessary files and optimize the local repository.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/7328931973353812376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/03/managing-git-file-size.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7328931973353812376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7328931973353812376'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/03/managing-git-file-size.html' title='Managing .git file size'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-2937162256661842366</id><published>2012-02-22T10:56:00.000+05:30</published><updated>2012-02-22T10:56:37.656+05:30</updated><title type='text'>Downgrading PHP Versions in Linux</title><content type='html'>Downgrading PHP Versions in Centos/Redhat using Yum.&lt;br /&gt;
&lt;br /&gt;
First you need to install allow downgrade option for Yum using the command:&lt;br /&gt;
# &lt;b&gt;yum install yum-allowdowngrade&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Configure yum.conf to include the following line “showdupesfromrepos=1” and the location of file is  /etc/yum.conf&lt;br /&gt;
# &lt;b&gt;vi /etc/yum.conf&lt;/b&gt;&lt;br /&gt;
Add the below line to this file.&lt;br /&gt;
&lt;b&gt;showdupesfromrepos=1&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Remove the current php package using the command:&lt;br /&gt;
# &lt;b&gt;yum remove php*&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now List avaliable php packages using the command:&lt;br /&gt;
# &lt;b&gt;yum list php&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now install the required version of php and required modules as follows (as an eg for php version 5.3.10):&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
# yum --allow-downgrade install php-5.3*&lt;br /&gt;
# yum --allow-downgrade install php-mbstring-5.3.10 php-mysql-5.3.10&lt;br /&gt;
# yum --allow-downgrade install php-gd-5.3.10&lt;br /&gt;
# yum --allow-downgrade install php-cli-5.3.10&lt;br /&gt;
# yum --allow-downgrade install php-mcrypt-5.3.10 php-standard-5.3.10 php-wddx-5.3.10 php-reader-5.3.10&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I refered this link: http://almamunbd.blogspot.com/2010/01/downgrading-php-53-to-php-52-using-yum.html</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/2937162256661842366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2012/02/downgrading-php-versions-in-linux.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2937162256661842366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2937162256661842366'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2012/02/downgrading-php-versions-in-linux.html' title='Downgrading PHP Versions in Linux'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-3510843815303153144</id><published>2011-12-27T11:51:00.001+05:30</published><updated>2012-01-02T10:54:31.468+05:30</updated><title type='text'>Alfresco (catalina.sh) Not starting at startup in Linux Server.</title><content type='html'>Our company using Alfresco and it has been installed through SVN. We are using the command catalina.sh start to start the alfresco. Our alfresco server is CentOS release 5.5 . &lt;br /&gt;
&lt;br /&gt;
We need to manually start the alfresco on every reboot and it is very tedious.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;To fix this issue we need to place the command (/opt/apache-tomcat-6.0.20/bin/catalina.sh start ) and the environment variables in system startup file (/etc/rc.d/rc.local) .&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In our case we follow these steps:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;vi /root/alfrescostart.sh&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the below lines:&lt;br /&gt;
####################################################################################&lt;br /&gt;
&lt;br /&gt;
export JAVA_OPTS=&quot;-Xmx1024M -XX:MaxPermSize=512M -Dcom.sun.management.jmxremote -Dalfresco.home=.&quot;&lt;br /&gt;
export JAVA_HOME=/usr/java/jdk1.6.0_29&lt;br /&gt;
export MVN_HOME=/opt/apache-maven-2.2.1&lt;br /&gt;
export ANT_HOME=/opt/apache-ant-1.8.2&lt;br /&gt;
export CATALINA_HOME=/opt/apache-tomcat-6.0.20&lt;br /&gt;
export TOMCAT_HOME=$CATALINA_HOME&lt;br /&gt;
export APP_TOMCAT_HOME=$CATALINA_HOME&lt;br /&gt;
export PATH=$JAVA_HOME/bin:$CATALINA_HOME/bin:$MVN_HOME/bin:$ANT_HOME/bin:$PATH&lt;br /&gt;
#Command to Start the catalina at startup&lt;br /&gt;
/opt/apache-tomcat-6.0.20/bin/catalina.sh start&lt;br /&gt;
&lt;br /&gt;
####################################################################################&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;chmod +x /root/alfrescostart.sh&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
Add the line “/root/alfrescostart.sh” line in /etc/rc.d/rc.local&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Thats all!....</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/3510843815303153144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/12/alfresco-catalinash-not-starting-at.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/3510843815303153144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/3510843815303153144'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/12/alfresco-catalinash-not-starting-at.html' title='Alfresco (catalina.sh) Not starting at startup in Linux Server.'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-3853109456938472611</id><published>2011-12-15T12:11:00.001+05:30</published><updated>2011-12-15T12:20:09.996+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP Fatal error:  Call to undefined function user_login_destination()"/><title type='text'>Drupal Integration with CAS for SSO</title><content type='html'>&lt;b&gt;Drupal Integration with CAS for SSO&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Requirements&lt;br /&gt;
============&lt;br /&gt;
PHP 5 with the following modules:&lt;br /&gt;
curl, openssl, dom, zlib, and xml&lt;br /&gt;
&lt;br /&gt;
Download phpCAS from https://wiki.jasig.org/display/CASC/phpCAS&lt;br /&gt;
phpCAS version 1.0.0 or later.&lt;br /&gt;
&lt;br /&gt;
There are several locations you can install the phpCAS library.&lt;br /&gt;
&lt;br /&gt;
1. Module directory installation. This means installing the library folder&lt;br /&gt;
under the moduels directory, so that the file&lt;br /&gt;
sites/&lt;site&gt;/modules/cas/CAS/CAS.php exists.&lt;br /&gt;
&lt;br /&gt;
2. System wide installation. See the phpCAS installation guide, currently at&lt;br /&gt;
https://wiki.jasig.org/display/CASC/phpCAS+installation+guide&lt;br /&gt;
&lt;br /&gt;
3. Libraries API installation. Install and enable the Libraries API module,&lt;br /&gt;
available at http://drupal.org/project/libraries. Then extract phpCAS so&lt;br /&gt;
that sites/&lt;site&gt;/libraries/CAS/CAS.php exists. For example:&lt;br /&gt;
$ cd sites/all/libraries&lt;br /&gt;
$ curl http://downloads.jasig.org/cas-clients/php/current.tgz | tar xz&lt;br /&gt;
$ mv CAS-* CAS&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 2: &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Download respective CAS Module from the link: http://drupal.org/project/cas&lt;br /&gt;
&lt;br /&gt;
Place the cas folder in your Drupal modules directory.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 3:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Configuring CAS&lt;br /&gt;
&lt;br /&gt;
Navigate to the CAS module configuration page at&lt;br /&gt;
Admin &gt;&gt; Users &gt;&gt; CAS Settings (D6)&lt;br /&gt;
Admin &gt;&gt; Configuration &gt;&gt; People &gt;&gt; CAS settings (D7)&lt;br /&gt;
Library (phpCAS)&lt;br /&gt;
&lt;br /&gt;
If phpCAS has been successfully installed, the version number of phpCAS will be displayed. Otherwise information is provided to help you install and configure phpCAS.&lt;br /&gt;
CAS Server&lt;br /&gt;
&lt;br /&gt;
Enter in the CAS server location. For example, if the CAS server is at https://www.example.com/cas, enter&lt;br /&gt;
Hostname or IP Address: www.example.com&lt;br /&gt;
Port: 443&lt;br /&gt;
URI: /cas&lt;br /&gt;
&lt;br /&gt;
For extra security, you may also provide the PEM Certificate of the Certificate Authority which issued the certificate of the CAS server.&lt;br /&gt;
Login Form&lt;br /&gt;
&lt;br /&gt;
These settings control how users may log into CAS using the user login form, either as displayed in a block or at user/login. Many installations will choose &quot;Add link to login forms&quot; or &quot;Make CAS login default on login forms.&quot;&lt;br /&gt;
&lt;br /&gt;
Additionally, the phrases used on the login forms may be customized for your particular brand.&lt;br /&gt;
User Accounts&lt;br /&gt;
&lt;br /&gt;
Each CAS user must have a Drupal account before they can log in. By default, the administrator must create the account and then assign the CAS username to the account.&lt;br /&gt;
&lt;br /&gt;
Selecting &quot;Automatically create Drupal accounts&quot; allows the administrator to skip pre-creating Drupal accounts and instead have Drupal accounts automatically be created when a CAS user first logs in.&lt;br /&gt;
&lt;br /&gt;
By default, the Drupal account will be created with a bare minimum of information:&lt;br /&gt;
Name: CAS username&lt;br /&gt;
E-mail: empty&lt;br /&gt;
Roles: authenticated user&lt;br /&gt;
Password: A random string which is not displayed to the user&lt;br /&gt;
&lt;br /&gt;
The e-mail address field may be populated if the e-mail addresses follow a predictable pattern based upon the CAS username — for example username@example.com.&lt;br /&gt;
&lt;br /&gt;
Additional roles may also be assigned to all CAS users. These roles will be reassigned every time a CAS user logs in. Deselecting an option will not take away that role from any existing user.&lt;br /&gt;
&lt;br /&gt;
The &quot;Users cannot change email address&quot; and &quot;Users cannot change password&quot; options control the user edit form when a user has logged in with CAS.&lt;br /&gt;
Redirection&lt;br /&gt;
&lt;br /&gt;
The &quot;Check with the CAS server to see if the user is already logged in?&quot; option implements the Gateway feature of the CAS protocol. When a user visit the site, they will be redirected to the CAS Server with the parameter gateway=true. If the user is already authenticated with the CAS server, they will be automatically logged in. If not, they will be silently redirected back to the Drupal site without being prompted for their password. This check is performed only once for users with cookies enabled. Beware: there might be some negative interactions with this feature and various caching configurations.&lt;br /&gt;
&lt;br /&gt;
The &quot;Require CAS login for&quot; options prompt for CAS authentication for anonymous users when visiting the specified pages. Users already authenticated with Drupal, even if they did not log in with CAS, will not be redirected to the CAS login server.&lt;br /&gt;
&lt;br /&gt;
For example, when configuring CAS with OpenScholar, one could add site/register to the list of pages to require CAS login for.&lt;br /&gt;
Login/Logout Destinations&lt;br /&gt;
&lt;br /&gt;
You may configure a special page for users to be redirected to the first time they log in to the CAS site. For example, you may wish to write an introductory page which all users should be required to see once. Or as above you may wish for users to be redirected to site/register in an OpenScholar installation.&lt;br /&gt;
&lt;br /&gt;
A logout destination may be provided if you want your users to be directed to a certain page when they log out of CAS. This is not the CAS server&#39;s URL, but rather a page on your site you would like the users to be directed to by the CAS server.&lt;br /&gt;
&lt;br /&gt;
Users are redirected to the &quot;Change password URL,&quot; if provided, when they visit user/password (&quot;Request a new password&quot;).&lt;br /&gt;
&lt;br /&gt;
Users are redirected to the &quot;Registration URL,&quot; if provided, when they visit user/register (&quot;Create a new account&quot;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;br /&gt;
&lt;br /&gt;
In Drupal 6.16 or Version below 6.22. CAS will not work properly. You will get an error in server error log as follows:&lt;br /&gt;
&lt;br /&gt;
PHP Fatal error:  Call to undefined function user_login_destination() in ../modules/cas/cas.module&lt;br /&gt;
&lt;br /&gt;
To fix this error: &lt;br /&gt;
&lt;br /&gt;
Add a customized form module in ../sites/all/modules/&lt;br /&gt;
For eg: ../sites/all/modules/sample_forms.module&lt;br /&gt;
&lt;br /&gt;
Now paste the below lines in sample_forms.module&lt;br /&gt;
#######################################################&lt;br /&gt;
function user_login_destination() {&lt;br /&gt;
$destination = drupal_get_destination();&lt;br /&gt;
return $destination == &#39;destination=user%2Flogin&#39; ? &#39;destination=user&#39; : $destination;&lt;br /&gt;
}&lt;br /&gt;
#######################################################&lt;br /&gt;
&lt;br /&gt;
&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/3853109456938472611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/12/drupal-integration-with-cas-for-sso.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/3853109456938472611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/3853109456938472611'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/12/drupal-integration-with-cas-for-sso.html' title='Drupal Integration with CAS for SSO'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-4976495544144201152</id><published>2011-11-23T17:27:00.001+05:30</published><updated>2011-12-06T17:08:21.152+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="backup mysql automatically"/><title type='text'>MySQL Replication cluster</title><content type='html'>&lt;b&gt;MySQL Replication cluster&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This guide is designed to help do the initial setup on a MySQL cluster in which multiple MySQL servers all serve the same content through the use of the replication function. We have successfully deployed this solution for multiple clients and it is a very good option for those needing a more powerful mysql solution. &lt;br /&gt;
&lt;br /&gt;
Be sure your mysql servers are running the same version before starting this guide, yes, is possible to have a few combinations of master-slave versions, for more information about this you can check:&lt;br /&gt;
&lt;br /&gt;
http://dev.mysql.com/doc/refman/4.1/en/replication-compatibility.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1 - Write down which is the setup you are going to do, which server is master and which server/s will be slave.&lt;br /&gt;
&lt;br /&gt;
2 - Select your username/password for replications accounts. You can have one per server if you want, or one for all the mysql network.&lt;br /&gt;
&lt;br /&gt;
3 - mysql&gt; GRANT REPLICATION SLAVE ON *.*&lt;br /&gt;
&lt;br /&gt;
TO &#39;USERNAME&#39;@&#39;IPFROMTHESLAVE&#39; IDENTIFIED BY &#39;PASSWORD&#39;;&lt;br /&gt;
&lt;br /&gt;
Username: mysql username&lt;br /&gt;
IPfromtheslave: ip from the mysql server that will be the one replicating the master db.&lt;br /&gt;
PASSWORD: the password for the replicator account.&lt;br /&gt;
&lt;br /&gt;
Just a few side notes.&lt;br /&gt;
&lt;br /&gt;
a) None of the passwords need to be root passwords.&lt;br /&gt;
b) Is not recomend to use only 1 user for replication in all the network.&lt;br /&gt;
&lt;br /&gt;
4) In the master server you need to Flush all the tables, this will prevent clients from writing the db so it will keep without change while we copy over.&lt;br /&gt;
&lt;br /&gt;
mysql&gt; FLUSH TABLES WITH READ LOCK;&lt;br /&gt;
&lt;br /&gt;
5) Make sure that the [mysqld] section of the my.cnf file on the master host includes a log-bin option. The section should also have a server-id=master_id option, where master_id must be a positive integer value from 1 to 232 – 1. For example:&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
&lt;br /&gt;
log-bin=mysql-bin&lt;br /&gt;
&lt;br /&gt;
server-id=1&lt;br /&gt;
&lt;br /&gt;
6) Login using another ssh client to the master server and lets create a snapshot.&lt;br /&gt;
&lt;br /&gt;
mkdir /home/slave_db&lt;br /&gt;
rsync -vrplogDtH /var/lib/mysql /home/slave_db&lt;br /&gt;
&lt;br /&gt;
You may not want to replicate the mysql  database if the slave server has a different set of user accounts from those that exist on the master. In this case, you should exclude it from the archive. When the rsync is finish, just login inside mysql and type:&lt;br /&gt;
&lt;br /&gt;
SHOW MASTER STATUS;&lt;br /&gt;
&lt;br /&gt;
Save this info in a txt file inside the slave_db folder that we will use them laster.  After you finish doing this, you can reenable the activity on the master: UNLOCK TABLES;&lt;br /&gt;
&lt;br /&gt;
7)  Stop the server that is to be used as a slave server and add the following to its my.cnf file:&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
&lt;br /&gt;
server-id=slave_id&lt;br /&gt;
&lt;br /&gt;
The slave_id value, like the master_id value, must be a positive integer value from 1 to 232 – 1. In addition, it is very important that the ID of the slave be different from the ID of the master. For example:&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
&lt;br /&gt;
server-id=2&lt;br /&gt;
&lt;br /&gt;
Remember that server-id must be unique in all the mysql network. &lt;br /&gt;
&lt;br /&gt;
8) Copy the files over from the slave_db folder to the remote location. You can do this doing the following command:&lt;br /&gt;
&lt;br /&gt;
rsync -e ssh -avz /home/slave_db/ root@REMOTESERVER:/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
Check that all the permitions and correctly in the /var/lib/mysql folder.Remember files must be own by mysql:mysql&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
9) Start Mysql and enter to it, write the following changing the values that are needed: &lt;br /&gt;
&lt;br /&gt;
mysql&gt; CHANGE MASTER TO&lt;br /&gt;
&lt;br /&gt;
-&gt;     MASTER_HOST=&#39;master_host_name&#39;,&lt;br /&gt;
&lt;br /&gt;
-&gt;     MASTER_USER=&#39;replication_user_name&#39;,&lt;br /&gt;
&lt;br /&gt;
-&gt;     MASTER_PASSWORD=&#39;replication_password&#39;,&lt;br /&gt;
&lt;br /&gt;
-&gt;     MASTER_LOG_FILE=&#39;recorded_log_file_name&#39;,&lt;br /&gt;
&lt;br /&gt;
-&gt;     MASTER_LOG_POS=recorded_log_position;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10) type: START SLAVE;</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/4976495544144201152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/11/mysql-replication-cluster.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/4976495544144201152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/4976495544144201152'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/11/mysql-replication-cluster.html' title='MySQL Replication cluster'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-5067938275595486389</id><published>2011-11-23T17:22:00.000+05:30</published><updated>2011-11-23T17:22:12.635+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="backup your website automatically"/><title type='text'>Mirror Your Web Site With rsync</title><content type='html'>This tutorial shows how you can mirror your web site from your main web server to a backup server that can take over if the main server fails. We use the tool rsync for this, and we make it run through a cron job that checks every x minutes if there is something to update on the mirror. Thus your backup server should usually be up to date if it has to take over.&lt;br /&gt;
&lt;br /&gt;
rsync updates only files that have changed, so you do not need to transfer 5 GB of data whenever you run rsync. It only mirrors new/changed files, and it can also delete files from the mirror that have been deleted on the main server. In addition to that it can preserve permissions and ownerships of mirrored files and directories; to preserve the ownerships, we need to run rsync as root which is what we do here. If permissions and/or ownerships change on the main server, rsync will also change them on the backup server.&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will tunnel rsync through SSH which is more secure; it also means you do not have to open another port in your firewall for rsync - it is enough if port 22 (SSH) is open. The problem is that SSH requires a password for logging in which is not good if you want to run rsync as a cron job. The need for a password requires human interaction which is not what we want.&lt;br /&gt;
&lt;br /&gt;
But fortunately there is a solution: the use of public keys. We create a pair of keys (on our backup server mirror.example.com), one of which is saved in a file on the remote system (server1.example.com). Afterwards we will not be prompted for a password anymore when we run rsync. This also includes cron jobs which is exactly what we want.&lt;br /&gt;
&lt;br /&gt;
As you might have guessed already from what I have written so far, the concept is that we initiate the mirroring of server1.example.com directly from mirror.example.com; server1.example.com does not have to do anything to get mirrored.&lt;br /&gt;
&lt;br /&gt;
I will use the following setup here:&lt;br /&gt;
&lt;br /&gt;
    * Main server: server1.example.com (server1) - IP address: 192.168.0.100&lt;br /&gt;
    * Mirror/backup server: mirror.example.com (mirror) - IP address: 192.168.0.175&lt;br /&gt;
    * The web site that is to be mirrored is in /var/www on server1.example.com.&lt;br /&gt;
&lt;br /&gt;
rsync is for mirroring files and directories only; if you want to mirror your MySQL database, please take a look at these tutorials:&lt;br /&gt;
&lt;br /&gt;
    * How To Set Up Database Replication In MySQL&lt;br /&gt;
    * How To Set Up A Load-Balanced MySQL Cluster&lt;br /&gt;
&lt;br /&gt;
I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!&lt;br /&gt;
&lt;br /&gt;
1 Install rsync&lt;br /&gt;
&lt;br /&gt;
First we have to install rsync on both server1.example.com and mirror.example.com. For Debian systems, this looks like this:&lt;br /&gt;
&lt;br /&gt;
server1/mirror:&lt;br /&gt;
&lt;br /&gt;
(We do this as root!)&lt;br /&gt;
&lt;br /&gt;
apt-get install rsync&lt;br /&gt;
&lt;br /&gt;
On other Linux distributions you would use yum (Fedora/CentOS) or yast (SuSE) to install rsync.&lt;br /&gt;
&lt;br /&gt;
2 Create An Unprivileged User On server1.example.com&lt;br /&gt;
&lt;br /&gt;
Now we create an unprivileged user called someuser on server1.example.com that will be used by rsync on mirror.example.com to mirror the directory /var/www (of course, someuser must have read permissions on /var/www on server1.example.com).&lt;br /&gt;
&lt;br /&gt;
server1:&lt;br /&gt;
&lt;br /&gt;
(We do this as root!)&lt;br /&gt;
&lt;br /&gt;
useradd -d /home/someuser -m -s /bin/bash someuser&lt;br /&gt;
&lt;br /&gt;
This will create the user someuser with the home directory /home/someuser and the login shell /bin/bash (it is important that someuser has a valid login shell - something like /bin/false does not work!). Now give someuser a password:&lt;br /&gt;
&lt;br /&gt;
passwd someuser&lt;br /&gt;
&lt;br /&gt;
3 Test rsync&lt;br /&gt;
&lt;br /&gt;
Next we test rsync on mirror.example.com. As root we do this:&lt;br /&gt;
&lt;br /&gt;
mirror:&lt;br /&gt;
&lt;br /&gt;
rsync -avz -e ssh someuser@server1.example.com:/var/www/ /var/www/&lt;br /&gt;
&lt;br /&gt;
You should see something like this. Answer with yes:&lt;br /&gt;
&lt;br /&gt;
The authenticity of host &#39;server1.example.com (192.168.0.100)&#39; can&#39;t be established.&lt;br /&gt;
RSA key fingerprint is 32:e5:79:8e:5f:5a:25:a9:f1:0d:ef:be:5b:a6:a6:23.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
&lt;br /&gt;
&lt;-- yes

Then enter someuser&#39;s password, and you should see that server1.example.com&#39;s /var/www directory is mirrored to /var/www on mirror.example.com.

You can check that like this on both servers:

server1/mirror:

ls -la /var/www

You should see that all files and directories have been mirrored to mirror.example.com, and the files and directories should have the same permissions/ownerships as on server1.example.com.

4 Create The Keys On mirror.example.com

Now we create the private/public key pair on mirror.example.com:

mirror:

(We do this as root!)

mkdir /root/rsync
ssh-keygen -t dsa -b 2048 -f /root/rsync/mirror-rsync-key

You will see something like this:

Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase): [press enter here]
Enter same passphrase again: [press enter here]
Your identification has been saved in /root/cron/mirror-rsync-key.
Your public key has been saved in /root/cron/mirror-rsync-key.pub.
The key fingerprint is:
68:95:35:44:91:f1:45:a4:af:3f:69:2a:ea:c5:4e:d7 root@mirror

It is important that you do not enter a passphrase otherwise the mirroring will not work without human interaction so simply hit enter!

Next, we copy our public key to server1.example.com:

mirror:

(Still, we do this as root.)

scp /root/rsync/mirror-rsync-key.pub someuser@server1.example.com:/home/someuser/

The public key mirror-rsync-key.pub should now be available in /home/someuser on server1.example.com. 

5 Configure server1.example.com

Now log in through SSH on server1.example.com as someuser (not root!) and do this:

server1:

(Please do this as someuser!)

mkdir ~/.ssh
chmod 700 ~/.ssh
mv ~/mirror-rsync-key.pub ~/.ssh/
cd ~/.ssh
touch authorized_keys
chmod 600 authorized_keys
cat mirror-rsync-key.pub &gt;&gt; authorized_keys&lt;br /&gt;
&lt;br /&gt;
By doing this, we have appended the contents of mirror-rsync-key.pub to the file /home/someuser/.ssh/authorized_keys. /home/someuser/.ssh/authorized_keys should look similar to this:&lt;br /&gt;
&lt;br /&gt;
server1:&lt;br /&gt;
&lt;br /&gt;
(Still as someuser!)&lt;br /&gt;
&lt;br /&gt;
vi /home/someuser/.ssh/authorized_keys&lt;br /&gt;
&lt;br /&gt;
ssh-dss AAAAB3NzaC1kc3MAAA[...]lSUom root@&lt;br /&gt;
mirror&lt;br /&gt;
&lt;br /&gt;
Now we want to allow connections only from mirror.example.com, and the connecting user should be allowed to use only rsync, so we add&lt;br /&gt;
&lt;br /&gt;
command=&quot;/home/someuser/rsync/checkrsync&quot;,from=&quot;mirror.example.com&quot;,no-port-forwarding,no-X11-forwarding,no-pty&lt;br /&gt;
&lt;br /&gt;
right at the beginning of /home/someuser/.ssh/authorized_keys:&lt;br /&gt;
&lt;br /&gt;
server1:&lt;br /&gt;
&lt;br /&gt;
(Still as someuser!)&lt;br /&gt;
&lt;br /&gt;
vi /home/someuser/.ssh/authorized_keys&lt;br /&gt;
&lt;br /&gt;
command=&quot;/home/someuser/rsync/checkrsync&quot;,from=&quot;mirror.example.com&quot;,no-port-forwarding,no-X11-forwarding,no-pty ssh-dss AAAAB3NzaC1kc3MAAA[...]lSUom root@&lt;br /&gt;
mirror&lt;br /&gt;
&lt;br /&gt;
It is important that you use a FQDN like mirror.example.com instead of an IP address after from=, otherwise the automated mirroring will not work!&lt;br /&gt;
&lt;br /&gt;
Now we create the script /home/someuser/rsync/checkrsync that rejects all commands except rsync.&lt;br /&gt;
&lt;br /&gt;
server1:&lt;br /&gt;
&lt;br /&gt;
(We still do this as someuser!)&lt;br /&gt;
&lt;br /&gt;
mkdir ~/rsync&lt;br /&gt;
vi ~/rsync/checkrsync&lt;br /&gt;
&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
case &quot;$SSH_ORIGINAL_COMMAND&quot; in&lt;br /&gt;
        *\&amp;*)&lt;br /&gt;
                echo &quot;Rejected&quot;&lt;br /&gt;
                ;;&lt;br /&gt;
        *\(*)&lt;br /&gt;
                echo &quot;Rejected&quot;&lt;br /&gt;
                ;;&lt;br /&gt;
        *\{*)&lt;br /&gt;
                echo &quot;Rejected&quot;&lt;br /&gt;
                ;;&lt;br /&gt;
        *\;*)&lt;br /&gt;
                echo &quot;Rejected&quot;&lt;br /&gt;
                ;;&lt;br /&gt;
        *\&lt;*)&lt;br /&gt;
                echo &quot;Rejected&quot;&lt;br /&gt;
                ;;&lt;br /&gt;
        *\`*)&lt;br /&gt;
                echo &quot;Rejected&quot;&lt;br /&gt;
                ;;&lt;br /&gt;
        rsync\ --server*)&lt;br /&gt;
                $SSH_ORIGINAL_COMMAND&lt;br /&gt;
                ;;&lt;br /&gt;
        *)&lt;br /&gt;
                echo &quot;Rejected&quot;&lt;br /&gt;
                ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
chmod 700 ~/rsync/checkrsync&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6 Test rsync On mirror.example.com&lt;br /&gt;
&lt;br /&gt;
Now we must test on mirror.example.com if we can mirror server1.example.com without being prompted for someuser&#39;s password. We do this:&lt;br /&gt;
&lt;br /&gt;
mirror:&lt;br /&gt;
&lt;br /&gt;
(We do this as root!)&lt;br /&gt;
&lt;br /&gt;
rsync -avz --delete --exclude=**/stats --exclude=**/error --exclude=**/files/pictures -e &quot;ssh -i /root/rsync/mirror-rsync-key&quot; someuser@server1.example.com:/var/www/ /var/www/&lt;br /&gt;
&lt;br /&gt;
(The --delete option means that files that have been deleted on server1.example.com should also be deleted on mirror.example.com. The --exclude option means that these files/directories should not be mirrored; e.g. --exclude=**/error means &quot;do not mirror /var/www/error&quot;. You can use multiple --exclude options. I have listed these options as examples; you can adjust the command to your needs. Have a look at &lt;br /&gt;
man rsync&lt;br /&gt;
&lt;br /&gt;
for more information.)&lt;br /&gt;
&lt;br /&gt;
You should now see that the mirroring takes place:&lt;br /&gt;
&lt;br /&gt;
receiving file list ... done&lt;br /&gt;
&lt;br /&gt;
sent 71 bytes  received 643 bytes  476.00 bytes/sec&lt;br /&gt;
total size is 64657  speedup is 90.56&lt;br /&gt;
&lt;br /&gt;
without being prompted for a password! This is what we wanted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7 Create A Cron Job&lt;br /&gt;
&lt;br /&gt;
We want to automate the mirroring, that is why we create a cron job for it on mirror.example.com. Run crontab -e as root:&lt;br /&gt;
&lt;br /&gt;
mirror:&lt;br /&gt;
&lt;br /&gt;
(We do this as root!)&lt;br /&gt;
&lt;br /&gt;
crontab -e&lt;br /&gt;
&lt;br /&gt;
and create a cron job like this:&lt;br /&gt;
&lt;br /&gt;
*/5 * * * * /usr/bin/rsync -azq --delete --exclude=**/stats --exclude=**/error --exclude=**/files/pictures -e &quot;ssh -i /root/rsync/mirror-rsync-key&quot; someuser@server1.example.com:/var/www/ /var/www/ &lt;br /&gt;
&lt;br /&gt;
This would run rsync every 5 minutes; adjust it to your needs (see&lt;br /&gt;
&lt;br /&gt;
man 5 crontab&lt;br /&gt;
&lt;br /&gt;
). I use the full path to rsync here (/usr/bin/rsync) just to go sure that cron knows where to find rsync. Your rsync location might differ. Run&lt;br /&gt;
&lt;br /&gt;
mirror:&lt;br /&gt;
&lt;br /&gt;
(We do this as root!)&lt;br /&gt;
&lt;br /&gt;
which rsync&lt;br /&gt;
&lt;br /&gt;
to find out where yours is.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8 Links&lt;br /&gt;
&lt;br /&gt;
    * rsync: http://samba.anu.edu.au/rsync</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/5067938275595486389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/11/mirror-your-web-site-with-rsync.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/5067938275595486389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/5067938275595486389'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/11/mirror-your-web-site-with-rsync.html' title='Mirror Your Web Site With rsync'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-291756101116497735</id><published>2011-11-23T17:12:00.000+05:30</published><updated>2011-11-23T17:12:03.715+05:30</updated><title type='text'>Logout root automatically when inactive</title><content type='html'>&lt;b&gt;Logout root automatically when inactive&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Generraly, administrators will stay login as “root” or forget to logout after finishing their work and leave their terminals unattended.&lt;br /&gt;
&lt;br /&gt;
The answer to solve this problem is to make the bash shell automatically logout after not being used for a period of time. For that, you must set the special variable named “TMOUT” to the time in seconds of no input before logout.&lt;br /&gt;
&lt;br /&gt;
Edit your profile file (vi /etc/profile) and add the following line somewhere after the line that read “HISTSIZE=” on this file:&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;TMOUT=7200&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The value we enter for the variable “TMOUT=” is in seconds and represents 2 hours (60 * 60 = 3600 * 2 = 7200 seconds). It is important to note that if you decide to put the above line in your /etc/profile file, then the automatic logout after two hours of inactivity will apply for all users on the system. So, instead, if your prefer to control which users will be automatically logged out and which ones are not, you can set this variable in their individual .bashrc file.&lt;br /&gt;
&lt;br /&gt;
After this parameter has been set on your system, you must logout and login again (as root) for the change to take effect.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/291756101116497735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/11/logout-root-automatically-when-inactive.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/291756101116497735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/291756101116497735'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/11/logout-root-automatically-when-inactive.html' title='Logout root automatically when inactive'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-7739803749150092893</id><published>2011-11-23T17:10:00.000+05:30</published><updated>2011-11-23T17:10:21.858+05:30</updated><title type='text'>Linux Shell Script to reboot DSL or ADSL router.</title><content type='html'>&lt;b&gt;Linux Shell Script to reboot DSL or ADSL router&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you need to reboot the router then you need to use web interface or telnet interface. Both methods take time, especially if you are playing with ACL, NAT or router firewall or you just wanna reboot the router from your Linux desktop. I have created simple script using expect tool to reboot router. Make sure you have expect command installed. Use rpm or apt-get command to install expect tool.&lt;br /&gt;
Shell script&lt;br /&gt;
&lt;br /&gt;
Create a script as follows (tested on Beetel ADSL 220x router):&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/expect -f&lt;br /&gt;
 &lt;br /&gt;
set timeout 20&lt;br /&gt;
 &lt;br /&gt;
# router user name&lt;br /&gt;
set name &quot;admin&quot;&lt;br /&gt;
 &lt;br /&gt;
# router password&lt;br /&gt;
set pass &quot;PASSWORD&quot;&lt;br /&gt;
 &lt;br /&gt;
# router IP address&lt;br /&gt;
set routerip &quot;192.168.1.254&quot;&lt;br /&gt;
 &lt;br /&gt;
# Read command as arg to this script&lt;br /&gt;
set routercmd [lindex $argv 0]&lt;br /&gt;
 &lt;br /&gt;
# start telnet&lt;br /&gt;
spawn telnet $routerip&lt;br /&gt;
 &lt;br /&gt;
# send username &amp;amp; password&lt;br /&gt;
expect &quot;Login:&quot;&lt;br /&gt;
send -- &quot;$name\r&quot;&lt;br /&gt;
expect &quot;Password:&quot;&lt;br /&gt;
send -- &quot;$pass\r&quot;&lt;br /&gt;
 &lt;br /&gt;
# get out of ISP&#39;s  Stupid menu program, go to shell&lt;br /&gt;
expect &quot; -&amp;gt; &quot;&lt;br /&gt;
send --  &quot;sh\r&quot;&lt;br /&gt;
 &lt;br /&gt;
# execute command&lt;br /&gt;
expect &quot;# &quot;&lt;br /&gt;
send -- &quot;$routercmd\r&quot;&lt;br /&gt;
# exit&lt;br /&gt;
send -- &quot;^D&quot;&lt;br /&gt;
&lt;br /&gt;
Save script and setup executable permission on it:&lt;br /&gt;
$ chmod +x router.exp&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
How do I run this script?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You need to pass command to script to execute on a router. For example to display router uptime, interface information and to reboot router you need to type command as follows:&lt;br /&gt;
$ ./router.exp uptime&lt;br /&gt;
$ ./router.exp ifconfig&lt;br /&gt;
$ ./router.exp reboot&lt;br /&gt;
&lt;br /&gt;
Since my ISP router offers menu as soon as login above script may not work on generic router such as Cisco or linksys router. Therefore, you may need to modify above script to work with your router. If you are a new to expect then use autoexpect command to generate script. It watches you interacting with another program and creates an Expect script that reproduces your interactions For straightline scripts, autoexpect saves substantial time over writing scripts by hand. Even if you are an Expect expert, you will find it convenient to use autoexpect to automate the more mindless parts of interactions. It is much easier to cut/paste hunks of autoexpect scripts together than to write them from scratch. Moreover, if you are a beginner, you may be able to get away with learning nothing more about Expect than how to call autoexpect. Just type autoexecpt:&lt;br /&gt;
$ autoexpectautoexpect started, file is script.exp&lt;br /&gt;
&lt;br /&gt;
Next type telnet command (telnet to the router):&lt;br /&gt;
$ telnet 192.168.1.254&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
Login: USER&lt;br /&gt;
Password: Password&lt;br /&gt;
&lt;br /&gt;
Now type commands on the router:&lt;br /&gt;
$ ifconfig&lt;br /&gt;
$ exit&lt;br /&gt;
You are done, type exit to stop autoexepct command:&lt;br /&gt;
$ exit&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
autoexpect done, file is script.exp&lt;br /&gt;
&lt;br /&gt;
Just type ./script.exp to run ifconfig command:&lt;br /&gt;
$ ./script.exp&lt;br /&gt;
&lt;br /&gt;
You can now modify script.exp to reboot or to run other commands. It is a real lifesaver.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/7739803749150092893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/11/linux-shell-script-to-reboot-dsl-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7739803749150092893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/7739803749150092893'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/11/linux-shell-script-to-reboot-dsl-or.html' title='Linux Shell Script to reboot DSL or ADSL router.'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-2088791125928634668</id><published>2011-11-23T17:07:00.000+05:30</published><updated>2011-11-23T17:07:07.063+05:30</updated><title type='text'>How to Prevent DDoS Attack</title><content type='html'>&lt;b&gt;How to Prevent DDoS Attack&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
All web servers been connected to the Internet subjected to DoS (Denial of Service) or DDoS (Distrubuted Denial of Service) attacks in some kind or another, where hackers or attackers launch large amount connections consistently and persistently to the server, and in advanced stage, distributed from multiple IP addresses or sources, in the hope to bring down the server or use up all network bandwidth and system resources to deny web pages serving or website not responding to legitimate visitors.&lt;br /&gt;
&lt;br /&gt;
You can detect the ddos using the following command&lt;br /&gt;
&lt;br /&gt;
netstat -anp|grep tcp|awk &#39;{print $5}&#39;| cut -d : -f1|sort|uniq -c|sort -n&lt;br /&gt;
&lt;br /&gt;
It will shows the number of connections from all IPs to the server.&lt;br /&gt;
&lt;br /&gt;
There are plenty of ways to prevent, stop, fight and kill off DDoS attack, such as using firewall. A low cost, and probably free method is by using software based firewall or filtering service. (D)DoS-Deflate is a free open source Unix/Linux script by MediaLayer that automatically mitigate (D)DoS attacks. It claims to be the best, free, open source solution to protect servers against some of the most excruciating DDoS attacks.&lt;br /&gt;
&lt;br /&gt;
(D)DoS-Deflate script basically monitors and tracks the IP addresses are sending and establishing large amount of TCP network connections such as mass emailing, DoS pings, HTTP requests) by using netstat command, which is the symptom of a denial of service attack. When it detects number of connections from a single node that exceeds certain preset limit, the script will automatically uses APF or IPTABLES to ban and block the IPs. Depending on the configuration, the banned IP addresses would be unbanned using APF or IPTABLES (only works on APF v 0.96 or better).&lt;br /&gt;
&lt;br /&gt;
Installation and setup of (D)DOS-Deflate on the server is extremely easy. Simply login as root by open SSH secure shell access to the server, and run the the following commands one by one:&lt;br /&gt;
&lt;br /&gt;
wget http://www.inetbase.com/scripts/ddos/install.sh&lt;br /&gt;
chmod 0700 install.sh&lt;br /&gt;
./install.sh&lt;br /&gt;
&lt;br /&gt;
To uninstall the (D)DOS-Deflate, run the following commands one by one instead:&lt;br /&gt;
&lt;br /&gt;
wget http://www.inetbase.com/scripts/ddos/uninstall.ddos&lt;br /&gt;
chmod 0700 uninstall.ddos&lt;br /&gt;
./uninstall.ddos&lt;br /&gt;
&lt;br /&gt;
The configuration file for (D)DOS-Deflate is ddos.conf, and by default it will have the following values:&lt;br /&gt;
&lt;br /&gt;
Code:&lt;br /&gt;
FREQ=1&lt;br /&gt;
NO_OF_CONNECTIONS=50&lt;br /&gt;
APF_BAN=1&lt;br /&gt;
KILL=1&lt;br /&gt;
EMAIL_TO=”root”&lt;br /&gt;
BAN_PERIOD=600&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Users can change any of these settings to suit the different need or usage pattern of different servers. It’s also possible to whitelist and permanently unblock (never ban) IP addresses by listing them in /usr/local/ddos/ignore.ip.list file. If you plan to execute and run the script interactively, users can set KILL=0 so that any bad IPs detected are not banned.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/2088791125928634668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/11/how-to-prevent-ddos-attack.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2088791125928634668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2088791125928634668'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/11/how-to-prevent-ddos-attack.html' title='How to Prevent DDoS Attack'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7224500646953226549.post-2122359109956441497</id><published>2011-11-23T17:04:00.001+05:30</published><updated>2011-11-23T17:04:12.110+05:30</updated><title type='text'>How to increase the memory limit of php</title><content type='html'>&lt;b&gt;How to increase the memory limit of php&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you have seen an error like “Fatal Error: PHP Allowed Memory Size Exhausted” in apache logs or in your browser, this means that PHP has exhausted the maximum memory limit. This post will show 3 different ways on how you can increase the php memory limit and also explain when you should use them.&lt;br /&gt;
&lt;br /&gt;
First, let’s see where is this limit coming from. Normally you will see from the error message what is the actual limit, as this will look like:&lt;br /&gt;
&lt;br /&gt;
&quot;PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y) in whatever.php&quot;&lt;br /&gt;
&lt;br /&gt;
The default value might differ depending on what php version and linux distribution you are running, but normally this will be set to either 8M or 16M. For example on my debian etch, running on php 5.2 this is set by default at 16M.&lt;br /&gt;
&lt;br /&gt;
In order to identify the current value on your system, look inside your php.ini and search for memory_limit:&lt;br /&gt;
memory_limit = 16M ; Maximum amount of memory a script may consume (16MB)&lt;br /&gt;
&lt;br /&gt;
There are three ways to change this value, the obvious way - changing the global value from php.ini, but also an individual method to change it just for a script, or folder.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Changing memory_limit globally from php.ini&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest and most obvious method. You just edit your php.ini and change the memory_limit to whatever you need. For ex:&lt;br /&gt;
&lt;br /&gt;
memory_limit = 32M&lt;br /&gt;
&lt;br /&gt;
You will require access to make changes to php.ini on the system. This change is global and will be used by all php scripts running on the system. Once you change this value, you will need to restart the web server in order for it to become active.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this limit has its logic and don’t increase it artificially, as poorly written php scripts might overkill your system without proper limits.&lt;br /&gt;
Note: if you know what you are doing and want to remove the memory limit, you would set this value to -1.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
2. Changing memory_limit using .htaccess for a single folder/vhost&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Changing the global memory_limit might not be a good idea, and you might be better changing this only inside one folder (normally one application or virtual host) that needs this value changed for its functionality. To do this you have to add to the respective location .htaccess something like:&lt;br /&gt;
&lt;br /&gt;
php_value memory_limit 64M&lt;br /&gt;
&lt;br /&gt;
This change will be local only, and can be useful for webmasters that don’t have control on the system php.ini. This change would not require a reload and will become active immediately.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Changing memory_limit inside a single php script.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For even more control you can set this directive inside a single php script. To do so you would use in your code:&lt;br /&gt;
&lt;br /&gt;
ini_set(&#39;memory_limit&#39;, &#39;64M&#39;);&lt;br /&gt;
&lt;br /&gt;
The advantage of this method is that you have more control and set this value just where you know it is really needed. Also it can be done without having access to the system php.ini, and will become active immediately.&lt;br /&gt;
&lt;br /&gt;
Note: in order to be able to use these PHP resource limits, your PHP version must have been compiled with the –enable-memory-limit configure option. Normally most packed versions will have this, but just in case if this doesn&#39;t work for you as expected, check on how php was compiled first.</content><link rel='replies' type='application/atom+xml' href='http://pcgeo.blogspot.com/feeds/2122359109956441497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://pcgeo.blogspot.com/2011/11/how-to-increase-memory-limit-of-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2122359109956441497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7224500646953226549/posts/default/2122359109956441497'/><link rel='alternate' type='text/html' href='http://pcgeo.blogspot.com/2011/11/how-to-increase-memory-limit-of-php.html' title='How to increase the memory limit of php'/><author><name>Geo P.C.</name><uri>http://www.blogger.com/profile/03206269473832448232</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='18' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheT3rY46Xf96chBBeER9p4sXfNGgzChs897v8U0X_18rmPSF41meHJ-aPkYZ3MsOQo1JlKQIRvw49lBH6l6mEMSmyQjezBhQr1i0NHhJpEQ5XVlPRTxuCqYaSiHjmYGA/s220/Geo.jpg'/></author><thr:total>0</thr:total></entry></feed>