Reputation: 39
How do you stop a fork bomb if you are already logged into a system?
Upvotes: 1
Views: 2239
Reputation: 61
Sree,
If you still have "control" in shell, you can try a ps
followed by a grep
, and some awk
, then a loop, to close all the processes including the parent.
Or manually...
If you're using bash
for example, you have to identify the parent process first:
ps -ef | grep -i /bin/bash
and it should show you all bash
processes running, in the third column you will see the parent process, you will see also that on multiple /bin/bash
processes have the same parent process -- which we need to kill in our case after you've identified the parent proc.
Just run a kill -9 PARENTPROC
(I don't recommend this if you don't feel comfortable :) with the parent proc.)
Or by name:
while :; do killall -9 processWithBombName; done
Basically you'll have to identify the process and kill it.
If you want to prevent a specific user from creating a fork bomb, you can limit it by taking a look at /etc/security/limits.conf, (you can do this on groups as well), inside you can append a line, something like:
Sree hard nproc 300
Which will limit user Sree to 300 processes.
Upvotes: 6