<?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>Tuts4Tech &#187; Bomb</title>
	<atom:link href="http://tuts4tech.net/tag/bomb/feed/" rel="self" type="application/rss+xml" />
	<link>http://tuts4tech.net</link>
	<description>Tech Tutorials</description>
	<lastBuildDate>Tue, 04 May 2010 20:35:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Understanding and Preventing Fork Bombs</title>
		<link>http://tuts4tech.net/2009/10/07/understanding-and-preventing-fork-bombs/</link>
		<comments>http://tuts4tech.net/2009/10/07/understanding-and-preventing-fork-bombs/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 16:26:57 +0000</pubDate>
		<dc:creator>Duffy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Bomb]]></category>
		<category><![CDATA[Fork]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[Reboot]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[System admin]]></category>

		<guid isPermaLink="false">http://tuts4tech.net/?p=595</guid>
		<description><![CDATA[A fork bomb is just a bash function that gets called recursively. Once a fork bomb is active on a machine it may not be able to preform normally until a reboot is made, as the only solution to the fork bomb is to kill all its processes. Bash Functions A fork bomb is really [...]]]></description>
			<content:encoded><![CDATA[<p>A fork bomb is just a bash function that gets called recursively. Once a fork bomb is active on a machine it may not be able to preform normally until a reboot is made, as the only solution to the fork bomb is to kill all its processes.</p>
<h3>Bash Functions</h3>
<p>A fork bomb is really just a bash function, below is an example of a bash function</p>
<pre class="brush: plain; title: ; notranslate">helloworld() {
echo hello world
};</pre>
<p>A fork bomb would be</p>
<pre class="brush: plain; title: ; notranslate">:(){
 :|:&amp;
};:</pre>
<p>Now to explain.<br />
:(){ - Creates the function<br />
:|: - Next it call itself using recursion and pipes the output to another call of the function<br />
&#038; - Puts the function call in the background so child cannot die<br />
}; - Terminate the function<br />
: - Call (run) the function</p>
<p>If you would like a more human readable fork bomb it would be as follows</p>
<pre class="brush: plain; title: ; notranslate">forkbomb(){
forkbomb | forkbomb &amp;
}; forkbomb</pre>
<h3>Preventing Fork Bombs</h3>
<p>We can prevent users from running fork bombs by limiting the amount of processes they are allowed to run.<br />
We can achive this using /etc/security/limits.conf</p>
<p>To get started open /etc/security/limits.conf</p>
<pre class="brush: plain; title: ; notranslate">nano /etc/security/limits.conf</pre>
<p>In my example I want to limit the user john to 300 processes and any users in the group of students to 250 processes. For this I would put the following into my config file</p>
<pre class="brush: plain; title: ; notranslate">john hard nproc 300
@students hard nproc 250</pre>
<p>Please keep in mind that KDE and Gnome desktop system can lanuch many processes.</p>
]]></content:encoded>
			<wfw:commentRss>http://tuts4tech.net/2009/10/07/understanding-and-preventing-fork-bombs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

