Man destroys his entire company with a five-character Bash command

Facepalm doesn't begin to cover it

A HOSTING COMPANY boss has completely destroyed his business with a single line of code.

Marco Marsala, who offered web hosting for 1,535 companies, first came to light after he posted in Server Fault that he had typed the immortal five characters 'rm -rf' into his server.

In English, this means 'shred everything and don't stop to warn me about the consequences'. So in the age-old tradition of garbage in, garbage out, the server complied. Bye bye company.

But what, we hear you cry, about the backups? Nope. Shred everything means shred absolutely everything including 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.

Source: inq