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

<channel>
	<title>Mohsin Sumar &#187; Tips &amp; Tricks</title>
	<atom:link href="http://www.mohsinsumar.com/category/tips-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mohsinsumar.com</link>
	<description>Zend Certified Engineer, PHP Professional, Designer &#38; Web Developer</description>
	<lastBuildDate>Thu, 22 Jul 2010 23:07:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Securing PHP application from malicious scripts</title>
		<link>http://www.mohsinsumar.com/php/securing-php-application-from-malicious-scripts/</link>
		<comments>http://www.mohsinsumar.com/php/securing-php-application-from-malicious-scripts/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 22:35:48 +0000</pubDate>
		<dc:creator>Mohsin Sumar</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[.htaccess disable directory listing]]></category>
		<category><![CDATA[how is chmod 777 insecure]]></category>
		<category><![CDATA[options all -indexes]]></category>
		<category><![CDATA[php application security]]></category>
		<category><![CDATA[php upload security]]></category>
		<category><![CDATA[prevent malicious code execution]]></category>
		<category><![CDATA[Secure File Uploads]]></category>

		<guid isPermaLink="false">http://www.mohsinsumar.com/?p=91</guid>
		<description><![CDATA[If you've stumbled across this post, then you've recently become a victim of the most famous way of uploading a malicious script to a website - PHP file uploads. Read through this article to understand the problem and an easy solution to add an extra layer of security to your web application. ]]></description>
			<content:encoded><![CDATA[<p>If you've stumbled across this post, then you've recently become a victim of the most famous way of uploading a malicious script to a website - PHP file uploads.</p>
<p>Many websites and web applications that are developed using PHP &amp; MySQL allow users to upload files, photos and documents to the server. Normally, the upload script receives the files and moves (or writes) it to a directory (folder) with write permissions. If you are on Linux, then this would mean that your folder CHMOD value is 0777.</p>
<p><span style="text-decoration: underline;"><strong>The Problem</strong></span><br />
The changing of CHMOD value to 0777 practically allows anyone in the WORLD to write to your folder and is therefore not recommended. However, many a times we are left with no option but to do so - depending on the servers' environment.</p>
<p><span style="text-decoration: underline;"><strong>How can this be a problem?</strong></span><br />
This allows attackers to upload upload a malicious PHP script to your directory, which they will then execute by accessing it. This script could either be a mass-mailing script or a malicious script to gain access to your account (or web server).</p>
<p><span style="text-decoration: underline;"><strong>The Solution</strong></span><br />
It is said that prevention is better than cure - and therefore, it is important to prevent these scripts from being executed by the server. This can very simply be done by adding a few lines of code to your .htaccess file. If your directory is supposed to hold photo files only, then the following code is recommended to prevent scripts from being executed.</p>
<p>It is also important to disable directory listing on these folders.</p>
<pre><span style="color: #800000;"># Disable Directory Listing
Options All -Indexes</span>

<span style="color: #800000;"># Allow access to these file extensions only
</span><span style="color: #800000;">&lt;FilesMatch "\.(htaccess|htpasswd|ini|php|cgi|pl|phps|sh)$"&gt;
 Order Allow,Deny
 Deny from all
&lt;/FilesMatch&gt;</span><span style="color: #800000;">
</span></pre>
<p>The above will add an extra layer of security to your web application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mohsinsumar.com/php/securing-php-application-from-malicious-scripts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How do I extract a tar file?</title>
		<link>http://www.mohsinsumar.com/ssh/how-do-i-extract-a-tar-file/</link>
		<comments>http://www.mohsinsumar.com/ssh/how-do-i-extract-a-tar-file/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 21:31:47 +0000</pubDate>
		<dc:creator>Mohsin Sumar</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[extract tar]]></category>

		<guid isPermaLink="false">http://www.mohsinsumar.com/?p=79</guid>
		<description><![CDATA[Using the following command in SSH, you will be able to extract files from your tar file.
tar -xf file.tar 
]]></description>
			<content:encoded><![CDATA[<p>Using the following command in SSH, you will be able to extract files from your tar file.</p>
<pre><span style="color: #800000;">tar -xf file.tar</span><tt> </tt></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mohsinsumar.com/ssh/how-do-i-extract-a-tar-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to tar a file using SSH?</title>
		<link>http://www.mohsinsumar.com/ssh/how-to-tar-a-file-using-ssh/</link>
		<comments>http://www.mohsinsumar.com/ssh/how-to-tar-a-file-using-ssh/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 17:23:13 +0000</pubDate>
		<dc:creator>Mohsin Sumar</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[compress tar]]></category>
		<category><![CDATA[create compressed tar]]></category>
		<category><![CDATA[tar file]]></category>

		<guid isPermaLink="false">http://www.mohsinsumar.com/?p=82</guid>
		<description><![CDATA[Use the following command if you want to create a tar and compress a file (or folder).
tar -czf /path/to/save/file.tar folder_or_file_name
The options used in the above command are outlined below for your understanding.
-c = create
-z = compress a file
-f = use the file mentioned instead of tape drive
]]></description>
			<content:encoded><![CDATA[<p>Use the following command if you want to create a tar and compress a file (or folder).</p>
<pre><span style="color: #800000;">tar -czf /path/to/save/file.tar folder_or_file_name</span></pre>
<p>The options used in the above command are outlined below for your understanding.</p>
<p>-c = create<br />
-z = compress a file<br />
-f = use the file mentioned instead of tape drive</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mohsinsumar.com/ssh/how-to-tar-a-file-using-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Commands to find files on Linux Server</title>
		<link>http://www.mohsinsumar.com/ssh/ssh-commands-to-find-files-on-linux-server/</link>
		<comments>http://www.mohsinsumar.com/ssh/ssh-commands-to-find-files-on-linux-server/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 04:49:26 +0000</pubDate>
		<dc:creator>Mohsin Sumar</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[email search results using ssh]]></category>
		<category><![CDATA[file search]]></category>
		<category><![CDATA[PuTTY]]></category>
		<category><![CDATA[save ssh search results to file]]></category>
		<category><![CDATA[search using ssh]]></category>

		<guid isPermaLink="false">http://www.mohsinsumar.com/?p=52</guid>
		<description><![CDATA[A couple of useful SSH commands to find files on your linux server.]]></description>
			<content:encoded><![CDATA[<p>If you have a dedicated server or a VPS - or any Linux machine with SSH access, the following commands may be useful to you if you are looking to find some files quickly. <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty" target="_blank">PuTTY</a> is a good telnet/SSH client if you don't already have one. Let's get started.</p>
<p>#1: If you are looking for a particular file in /home directory</p>
<pre><span style="color: #800000;">find /home -name filename</span></pre>
<p>#2: If you are looking for files whose name is starting with "filename" in public_html directories only, you can use the following command:-</p>
<pre><span style="color: #800000;">find /home/*/public_html -name filename* </span></pre>
<p>#3: Instead of viewing your search results in command line, you can write it to file by using this:</p>
<pre><span style="color: #800000;">find /home/*/public_html -name filename* &gt; /home/filename_search.txt</span></pre>
<p>#4: Alternatively, you can send it via e-mail directly from server using the command below. Don't forget to replace "Subject Here" with your email subject, and "email.address@domain" with your email ID.</p>
<pre><span style="color: #800000;">find /home/*/public_html -name filename* |mail -s "Subject Here" e-mail.address@domain
</span></pre>
<p>I hope this was useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mohsinsumar.com/ssh/ssh-commands-to-find-files-on-linux-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data recovery from a corrupt hard disk</title>
		<link>http://www.mohsinsumar.com/tips-tricks/data-recovery-from-a-corrupt-hard-disk/</link>
		<comments>http://www.mohsinsumar.com/tips-tricks/data-recovery-from-a-corrupt-hard-disk/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:58:52 +0000</pubDate>
		<dc:creator>Mohsin Sumar</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Data Recovery]]></category>
		<category><![CDATA[R-Studio]]></category>

		<guid isPermaLink="false">http://www.mohsinsumar.com/?p=13</guid>
		<description><![CDATA[Earlier this week, I was transferring all my important data from my  external 120GB USB hard disk to my new laptop. During the process, the transfer became unbearably slow. I decided to cancel it and reboot my computer to get a fresh start.
To my dismay, Windows Vista detects the hard drive but is unable [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Earlier this week, I was transferring all my important data from my  external 120GB USB hard disk to my new laptop. During the process, the transfer became unbearably slow. I decided to cancel it and reboot my computer to get a fresh start.</p>
<p style="text-align: justify;">To my dismay, Windows Vista detects the hard drive but is unable to read it prompting me to format the drive. After a bit of reading, and trying to access the drive in different ways - I got the following error message.</p>
<p style="text-align: justify;"><strong>Disk is unaccessible.<br />
The file or directory is corrupted and unreadable. </strong></p>
<p style="text-align: justify;">It was impossible for me to let go of all my data and thus, I started looking into ways to recover it.</p>
<p style="text-align: justify;">During the process, I realized that the format of my drive had changed from NTFS to RAW - which was rather strange. Searching through Google on Data Recovery Software, I stumbled upon a neat software called <a href="http://www.r-studio.com/" target="_blank">R-Studio</a>. I downloaded its trial version to give it a try.</p>
<p style="text-align: justify;">It took approximately 7 hours for it to scan through my corrupt hard drive - after which I could view all my folder structure &amp; files in the hard drive. You can only preview data or recover upto 64 Kb in the demo version of R-Studio. I tested its recover data tool and was very impressed to see that it managed to recover my data.</p>
<p style="text-align: justify;">I purchased the full version of the software for a worthy price of USD 79.99 - got the license key immediately after making payment and started off recovering my data.</p>
<p style="text-align: justify;">Thanks to R-Studio, I have recovered most of my data - besides some that resided on bad clusters.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mohsinsumar.com/tips-tricks/data-recovery-from-a-corrupt-hard-disk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
