Hello,
I have found some commands in a forum under "top ten unix commands" topic and I'd like to ask: what does below command do:
Could it really be a command or a joke?
Hi, this is one of the most well known "fork bombs". The use of ":" as a function name will work in bash or zsh, but not in most other shells. It is an unlimited recursive function that keeps calling itself and spawning new processes until your computer runs out of resources.
Never run that, or your computer will come to a crawl and it will need to be rebooted if there are no provisions to limit your user processes.
Last edited by Scrutinizer; 05-02-2019 at 01:03 AM..
These 7 Users Gave Thanks to Scrutinizer For This Post:
One of our developers unleashed this very fork bomb. On a development box. Fortunately developers did not have shell level access to production. There is a special account to fix prod problems. That account has a password change every 7 days, when on-call rotates to another user.
This why you do not let anyone except a special highly controlled account onto prod. We script-ed the account, just to be able to report to auditors what exactly each and every action against the prod db and files was. This included code pushes.
And no, it is not a joke. Never trust anything from that site again if they presented the forkbomb as something benign.
These 5 Users Gave Thanks to jim mcnamara For This Post:
Looks like another fork bomb.
Harden your system! For example, RedHat/Centos 7.x has
At login (generally: at every system access) this limit is set by PAM. Can be verified with
Caution, even if the root account were not excepted, the PAM might not set the limit for UID=0 accounts. Another reason to not run suspicious code as root!
This User Gave Thanks to MadeInGermany For This Post:
OO oriented programming lends itself to quick acting fork_bombing and memory eating.
Take this Python code deliberately held back:
Results OSX 10.14.3, default bash terminal calling Python 3.5.2.
As one can see the fork bomb although not obfuscated is a single line of code and very dangerous.
Object Orientation OTOH is memory hungry and anyone with any knowledge can do that from Python interactive shell.
With only 2MB of memory on a stock AMIGA A1200 and Python this stood out only too well as soon my 2MB was gone.
These 2 Users Gave Thanks to wisecracker For This Post:
Hello,
I have found some commands in a forum under "top ten unix commands" topic and I'd like to ask: what does below command do:
Could it really be a command or a joke?
Thanks
Boris
If you consider : as True, NOP or Pass and use the 'True' meaning then I will rewrite in a method that is understandable.