Man claims to have destroyed web hosting business with a single line of code
Think first before you "rm -rf"
The boss of a web hosting company appears to have completely destroyed his business by carelessly apply a single line of code.
Marco Marsala, whose company hosted websites for 1,535 companies, posted in Server Fault that he had typed the immortal five characters 'rm -rf' into his Linux server as part of a broader instruction.
In plain English, this means delete everything without the usual warnings. But not only did he delete everything on the server, but also his backups. "All servers got deleted and the offsite backups too because the remote storage was mounted just before by the same script (i.e. a backup maintenance script)," Marsala said in the thread.
In fairness, Marsala wasn't as dumb as he sounds. The problem wasn't in typing 'rm -rf' as such, although it's best to avoid using it, but was actually in another line of code, meaning that the server didn't know to be selective.
"I run a small hosting provider with 1,535 customers and I use Ansible to automate some operations to be run on all servers," he wrote.
"Last night I accidentally ran, on all servers, a Bash script with a rm -rf {foo}/{bar} with those variables undefined due to a bug in the code above this line."
The Bash command line is the same one recently added to Windows in a tie-up with Ubuntu.
It's not the first time that an entire server has been wiped, of course. Kim Dotcom accused hosting company LeaseWeb of wiping data pertaining to his controversial Megaupload service in 2013.
The responses from the Server Fault community were refreshingly frank. Some offered hindsight on how to avoid the problem happening again, while others simply pointed out that future mitigation was irrelevant as the chances of getting the data back are minimal.
"You're going out of business," wrote user Michael Hampton. "You don't need technical advice, you need to call your lawyer."
Ouch. Harsh but fair.