Page 1 of 2

oh snap... you rekt...

PostPosted: Fri Apr 15, 2016 10:39 am
by Heffernan
http://www.independent.co.uk/life-style ... 84256.html

http://serverfault.com/questions/769357 ... om-a-rm-rf

I run a small hosting provider with more or less 1535 customers and I use Ansible to automate some operations to be run on all servers. 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.

All servers got deleted and the offsite backups too because the remote storage was mounted just before by the same script (that is a backup maintenance script).

How I can recover from a rm -rf / now in a timely manner?

Re: oh snap... you rekt...

PostPosted: Fri Apr 15, 2016 10:48 am
by Thor
Best to not code drunk.

Re: oh snap... you rekt...

PostPosted: Fri Apr 15, 2016 11:22 am
by Forungi
¦] Best troll of 2016 confirmed ¦]

Re: oh snap... you rekt...

PostPosted: Fri Apr 15, 2016 11:53 am
by Kandarim
and that, children, is why you always dry-run a script involving rm.

Also, I am pretty sure it's just a troll post. rm uses --preserve-root by default (don't remove "/"), which no sane person would ever turn off.

Re: oh snap... you rekt...

PostPosted: Fri Apr 15, 2016 12:35 pm
by Qiresea
that can't be true. what kind of an idiot would run an rm -rf, seriously... :lol:

Re: oh snap... you rekt...

PostPosted: Fri Apr 15, 2016 12:55 pm
by Kandarim
rm -rf is used quite often, and occasionally even in scripts like the above one.
However, you should never ever turn off --preserve-root. There have been cases of hardbricking laptops (because, as I recall, the UEFI motherboard settings can be removed through linux mountpoints)...

FFR, the safe usage is not to include any slashes whatsoever in your rm command, i.e. doing
cd /dir/path/
rm -rf dir

Still, I think the above issues deserved it for their careless use of rm. Seriously, who 'accidentally's --no-preserve-root?

Re: oh snap... you rekt...

PostPosted: Fri Apr 15, 2016 6:56 pm
by saltmummy
Good luck getting a new job in the programming sector after this.

Re: oh snap... you rekt...

PostPosted: Sun Apr 17, 2016 9:04 am
by Inotdead
Wow.

I'll just pretend that it was intentional sabotage and the man got bribed to do that.

Re: oh snap... you rekt...

PostPosted: Sun Apr 17, 2016 12:30 pm
by Dallane
saltmummy wrote:Good luck getting a new job in the programming sector after this.


This wont affect anything with getting jobs.

Re: oh snap... you rekt...

PostPosted: Sun Apr 17, 2016 12:48 pm
by Heffernan
Dallane wrote:
saltmummy wrote:Good luck getting a new job in the programming sector after this.


This wont affect anything with getting jobs.


yeah right? how would destroying a whole company not get him a new job.... right guys...?