GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I found this posted by another user on this forum. It is a Fork Bomb which creates a function that calls itself infinitely, consuming all process slots on the computer and freezing it.
I know it isn't bulletproof, but would your first thought really be that someone has messed with your aliases? Maybe it would, but it sure wasn't mine! This worked on me like a treat.
This is a more concise example of the above fork. That line spawns two versions of the program each time around and both those form two more, etc.
For a fun way...
Code:
chmod -Rf 0000 /*
Makes every file on the system unreadable, unwritable, and unexecutable. And it's fun to try and add execute persmissions back when chmod can't be run.
I like this because everything still there... so tempting... but so completely ruined. Reinstall time because you'll never get the permissions right again.
I could have sworn I've been in situations before where this wouldn't work because it removed execute permission from the toplevel directory first, then tried the children. But I can't get it to work now, so maybe I'm thinking of chown instead...
Anyway, this being irreparable hinges on making / non-exec, but that means all you'd have to do to fix it is use a live CD and mount this partition somewhere the parent directory has exec bit set. Right?
Distribution: OpenSUSE 11.3 KDE, PCLinuxOS 2010 KDE
Posts: 29
Rep:
Quote:
I found this posted by another user on this forum. It is a Fork Bomb which creates a function that calls itself infinitely, consuming all process slots on the computer and freezing it.
I used to do this on windows xp with batch files ... try running a program if you're pagefile is over 2GB and your real memory is only 512MB
In *NIX, if i wish to log out quicky i just enter (as root) killall x
works all of the time
I could have sworn I've been in situations before where this wouldn't work because it removed execute permission from the toplevel directory first, then tried the children. But I can't get it to work now, so maybe I'm thinking of chown instead...
Anyway, this being irreparable hinges on making / non-exec, but that means all you'd have to do to fix it is use a live CD and mount this partition somewhere the parent directory has exec bit set. Right?
Not quite. This command changes all the permissions of all the files and directories on the system. The part which makes it impossible to repair (at least without a reboot to clean media like a live CD) is that the tools you need to fix this (chmod in this case) can't be run because they don't have execute permission.
Yeah, it's also true that you can't navigate the filesystem thanks to the removal of the read and execute bits from directories (which makes it more frustrating).
Fixing this is more complicated than just mounting it somewhere else. You need to boot into a clean filesystem, like from a live CD, and repair all the permissions back to what they should be. It's probably easier to reinstall the base system and then go through and redo the user partitions by hand with a default umask of 0700 for directories and 0600 for files... and then let them make it less restrictive as they want.
There is nothing to prevent this command from running to completion because it's already in memory and running when it changes it's own permissions on disk.
Examples after running it:
Code:
# ls
ls: permission denied
# echo *
altroot bin boot dev etc home kern lib libexec mnt netbsd proc rescue root sbin stand tmp usr var
# cd bin
# echo *
[contents cut for space but shows all files]
#chmod +x /bin/ls
chmod: permission denied
All the files are still there but you can't use them or any of the utilities. Echo is a shell-builtin as is cd... so they still function although I'm shocked that you can cd still, that may be a function of how netbsd treats root though. Yeah, this is a netbsd system but the effect is the same everywhere.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.