The other day I was doing some maintenance tasks on my web server. I was in hurry and sleepy, so I did everything using sudo command.
And then, I accidentally pressed Ctrl+V, sending this command to my web server:
sudo rm -rf /*
For those wondering what above command does: This deleted my whole web server
Luckily, I had backups and sadly, I had to spend two more hours being awake to fix this awesome error. But since then, I have been wondering:
Is there a way to always enforce sudo password for specific command?
If the server asked me for a password, I would save myself from lot of trouble. It did not, because I ran about 5 sudo commands before this majestic error.
So, is there a way to do it? I just need the password with the rm command to always be enforced. Other commands I am using are usually nano or cp which both are (to some extent) revertable.
