<?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>Linux, Programming, Telephony, Asterisk, Apache, Tips &#38; Tricks &#187; Securities</title>
	<atom:link href="http://shahidz.com/category/securities/feed/" rel="self" type="application/rss+xml" />
	<link>http://shahidz.com</link>
	<description>Passionate About Technology</description>
	<lastBuildDate>Wed, 18 Aug 2010 07:03:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>moving mysql data directory</title>
		<link>http://shahidz.com/moving-mysql-data-directory/</link>
		<comments>http://shahidz.com/moving-mysql-data-directory/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 17:38:11 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Securities]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://shahidz.com/?p=104</guid>
		<description><![CDATA[In some cases you have to change the default MySql data directory, for doing this you have to follow some steps. Here I will explain each steps one by one.

Stop MySql server using following command.
$ sudo /etc/init.d/mysql stop
Copy the existing data directory (which is located in /var/lib/mysql) using following command.
$ sudo cp -R -p /var/lib/mysql /path/to/new/datadir
Edit [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://shahidz.com/wp-content/uploads/2010/01/logo-mysql-300x218.jpg"><img class="alignleft size-full wp-image-117" title="logo-mysql-300x218" src="http://shahidz.com/wp-content/uploads/2010/01/logo-mysql-300x218.jpg" alt="" width="300" height="218" /></a>In some cases you have to change the default MySql data directory, for doing this you have to follow some steps. Here I will explain each steps one by one.</p>
<ol>
<li>Stop MySql server using following command.</li>
<pre>$ sudo /etc/init.d/mysql stop</pre>
<li>Copy the existing data directory (which is located in <em>/var/lib/mysql</em>) using following command.</li>
<pre>$ sudo cp -R -p /var/lib/mysql /path/to/new/datadir</pre>
<li>Edit the MySQL configuration file with your favorite text editor.</li>
<pre>$ sudo vim /etc/mysql/my.cnf</pre>
<li>Find the entry for <em>datadir</em>, change the path to the new data directory.</li>
<li>Some Linux distributions uses some security software called <strong>AppArmor </strong>that specifies the areas of your filesystem applications are allowed to access. Unless you modify the AppArmor profile for MySQL, you&#8217;ll never be able to restart MySQL with the new datadir location. So edit the file <em>/etc/apparmor.d/usr.sbin.mysqld</em> using your favorite editor.</li>
<pre>$ sudo vim /etc/apparmor.d/usr.sbin.mysqld</pre>
<li>Duplicate the lines beginning with <em>/var/lib/mysql</em> and replace duplicated strings with /<em>new_datadir.</em></li>
<pre><em>/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
/var/log/mysql/ r,
/var/log/mysql/* rw,
#
/path/to/new/datadir r,
/path/to/new/datadir** rwk,
/path/to/new/datadir r,
/path/to/new/datadir* rw,</em></pre>
<li>Restart the AppArmor profiles with the following command.</li>
<pre>$ sudo /etc/init.d/apparmor restart</pre>
<li>Restart the MySql server with the following command.</li>
<pre>$ sudo /etc/init.d/mysql start</pre>
</ol>
<p>MySQL should now start without any errors and your data will be stored in the new location.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fmoving-mysql-data-directory%2F&amp;linkname=moving%20mysql%20data%20directory"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/moving-mysql-data-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iptables port forwarding on ubuntu</title>
		<link>http://shahidz.com/iptables-port-forwarding-on-ubuntu/</link>
		<comments>http://shahidz.com/iptables-port-forwarding-on-ubuntu/#comments</comments>
		<pubDate>Sun, 27 Jul 2008 05:31:52 +0000</pubDate>
		<dc:creator>Shahid</dc:creator>
				<category><![CDATA[Iptables]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Securities]]></category>
		<category><![CDATA[port forwarding]]></category>

		<guid isPermaLink="false">http://shahidz.com/iptables-port-forwarding-on-ubuntu/</guid>
		<description><![CDATA[What is Port Forwarding?
Port forwarding is a feature of the IPTables system.  It allows one computer to forward connections made to it so that another computer can actually process the request.  If you want a very simple metaphor you can think of it as mail forwarding.  Each computer has a number of [...]]]></description>
			<content:encoded><![CDATA[<h3>What is Port Forwarding?</h3>
<p align="justify">Port forwarding is a feature of the IPTables system.  It allows one computer to forward connections made to it so that another computer can actually process the request.  If you want a very simple metaphor you can think of it as mail forwarding.  Each computer has a number of addresses called ports, and IPTables allows connections to these ports to be sent to another computer. With port forwarders, you can redirect data connections from the Internet to  an internal, privately addressed machine behind your IP MASQ server.  This  forwarding ability includes network protocols such as TELNET, WWW, and SMTP.  Protocols such as FTP, legacy ICQ, and others require special handling via kernel modules.</p>
<h3 align="justify">Setup</h3>
<p>On Ubuntu you need to enable port forwarding. For doing this you have to be the root user.</p>
<pre>root@shahid-laptop:~# echo 1 &gt; /proc/sys/net/ipv4/ip_forward</pre>
<p>After this you need to write iptable rule.</p>
<pre>root@shahid-laptop:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
root@shahid-laptop:~# iptables -t nat -A PREROUTING -p tcp -i eth0 -d 192.168.0.10 --dport 555 -j DNAT --to 192.168.0.12:22
root@shahid-laptop:~# iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.12 --dport 22 -j ACCEPT</pre>
<p align="justify">In this rule, when we tries to connect to the IP 192.168.0.10 through the port 555 this system redirects the connection to the IP and 192.168.0.12 and port 22.</p>
<p>To see the iptables rule use the command &#8216;iptables -L&#8217;</p>
<pre>root@shahid-laptop:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             192.168.0.12        tcp dpt:ssh 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination</pre>
<h3>Saving Data</h3>
<p align="justify">When you reboot the system the iptables rules will be removed from the kernel module , so either you need to use <em>iptables-save</em> and <em>iptables-restore</em>for saving and restoring iptable rules or you need to write a script which will execut on every boot for enabling and create the iptable rule.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fshahidz.com%2Fiptables-port-forwarding-on-ubuntu%2F&amp;linkname=iptables%20port%20forwarding%20on%20ubuntu"><img src="http://shahidz.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://shahidz.com/iptables-port-forwarding-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
