cc4vjq
Last Updated: February 25, 2016
·
1.308K
· dlion
28864ba1e7e4490c3e5e97e095d4b6c7

Prevent a Fork Bomb

If you want prevent a fork bomb attack you can limit the process open by user so the system will block the attack allows to kill it.

Became a root

su -

Open a profile file

vim /etc/profile

and edit this line:

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
 PATH="$PATH:."
fi

in

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
 ulimit -u 300
fi

So you can set the maximum open process by user of 300 processes.

After Reboot, If you want to try your fix, you can execute this:

:(){ :|:& };:

This is a short recursively bash function:

:()
{
    : | : &
}

:

This is it.

Say Thanks
Respond
Filed Under