New 5 major Linux destruction spells
This is Saito from the infrastructure team.
This time, I would like to take a different approach and introduce dangerous Linux commands in a ranking format. Titled ` `New 5 Great Spells of Destruction''
We also have items that are not ranked.
So let me introduce it to you.
5th place: iptables
sudo iptables -I INPUT -j DROP
● Evaluation point: Stops working instantly
iptables is usually a pain to use, but this command stops working from the moment you type it.
Therefore, it would be very troublesome to do this on a server that cannot be restarted. On the other hand, as long as you restart it, it will still work.
4th place: git
git reset --hard HEAD~3 && git push -u --force origin master
● Evaluation point: Causes trouble for colleagues as well.
Force an overwrite to the remote repository.
By doing this, you will delete all of your coworker's pushes. I'm still not feeling well because I've done a reset. Never do this if you are working with a group of people on a remote repository.
3rd place: chmod
sudo chmod -R 000 /
● Evaluation points: All become zero.
It's a pretty dangerous command, but it's relatively easy to pass.
After the command passes without any problems, you will lose all access privileges within the server. Even in this situation, the pwd command returns the correct display.
2nd place: rsync
mkdir hoge;sudo rsync -av --delete-excluded /hoge/ /
● Evaluation point: No longer synchronized
rsync is a command for synchronizing files, and rsync has many options. Of the many options, many of the necessary options are grouped together by -a.
Therefore, avoid using options labeled delete casually.
Using the above command will sync your empty files and OS and everything will disappear.
1st place:rm
sudo rm -rf / --no-preserve-root
● Evaluation point: It can be erased after all.
In recent OSes, if you enter a command such as rm -rf / to erase everything under /, the OS will say "wait" and the command will not work. Thank you very much.
However, there is an option to nullify such kindness: --no-preserve-root . Now everything disappears.
Not ranked
rm -rf <folder>
● Evaluation points: Easy
Adding sudo is a very dangerous command. This is because you can easily delete folders and files. (Actually, there is a way to return it, but that's for another time.)
This is a command that amateurs cannot easily enter. I think some people might use it depending on the situation, so I'll leave it out of the ranking. Please leave this kind of work to a server engineer.
summary
What did you think?
Your colleagues in the same industry may have had their heart rates increase. Drink some tea and relax.
There are several other dangerous commands, such as fork bomb :(){ :|:& };:, so don't try fork bombs on Docker. There is a precedent for causing fatal damage to the host OS.
All the commands introduced this time were executed on VirtualBox + Vagrant, but sometimes the entire box disappears, or the Vagrantfile permissions or the file itself disappears. Never do this on a business terminal.
That's it.