Our company just took contract to make some changes in client's wordpress based cms site a Day ago.

I connectd ssh to his site.And i was just browsing his site thru linux shell.

I pressed ls -l and saw 1folder was empty. But instead of going to that folder , by mistake i pressed rm -rf * from root directory.

I know its big mistake, but i want to know what can be done now??

For your info: Clients site was made 5 years ago by another developer who now doesnt have backup. We receive website details but i by mistake deleted root folder and files :( .Please suggest how should i handle this situation.

  • 4
    belongs on the superusers discussion. – keshlam Apr 18 '15 at 14:29
  • First action before doing anything next time is to take your own backup. Also, some service hosts provide an automatic backup service which takes regular snapshots of data. Maybe you could see if this is the case by calling the service provider. – Brandin Apr 18 '15 at 14:53
  • 1
    Everyone can make mistakes. Really. I hope that the "seasoned professionals" among you who think you're immune from something like this happening to you will be able handle the shock WHEN you do mess-up big time. Technically this is a matter of working the back-up system (possibly appropriate for superuses stackexchange). Workplace-wise, the answers should give you some advice on how to handle the repercussions of making an embarrassing and possibly costly mistake (that aspect is certainly answerable here). – teego1967 Apr 18 '15 at 15:50
  • Surely this must be joke. If it wasn't a joke, anyone having anything to do with Unix or Linux knows that this is not something that will ever happen by mistake, so I would fire the poster immediately for intentionally damaging a client's website. – gnasher729 Apr 18 '15 at 18:49
  • 1
    For future reference :) 1) rmdir is a safer way to remove an empty directory, because it will fail and complain if you accidentally use it on a non-empty directory 2) in most cases, it's safer to work from a non-root account with sudo access, rather than an actual root account. Having to explicitly tell the computer when you want to use root privileges per-command reduces the chance of costly mistakes. (and as others have said: always BEGIN by making a backup, just in case.) also: avoid using -f unless it's really necessary. Having to type y once isn't a big deal. – LindaJeanne Apr 18 '15 at 21:51

Wrong area of SE.

And asking SE was the wrong action. You should have powered the machine down IMMEDIATELY and not let it be turned on until an expert can deal with it. The time you took to seek an answer here may have made the problem unrecoverable.

As I said in the comments, you probably had no justification for being logged in as root in the first place, for exactly this sort of reason.

However, the only business-related part of this is: Admit the error immediately. Even if you have the skills/tools to reconstruct the filesystem yourself, the customer deserves to know that they may have lost data. Trying to sweep this under the rug is likely to make the situation much worse that admitting you made a beginner's mistake.

  • But whole website is down.Am i in danger of being fired? – 0____________0 Apr 18 '15 at 14:34
  • 4
    Taking the time to ask us isn't going to reduce the odds of your being fired. Working the technical problem and admitting your error may save your job. We have no way of predicting the outcome; the answer depend on exactly what was lost, how much can be recovered, and how willing the customer is to give you a second chance. Ask them, not us. – keshlam Apr 18 '15 at 14:39
  • 1
    @user122834 Adding to the constructive comments of other posters - yes you are in danger of being fired. Also your company is in danger of losing the contract it just got. Will either of those happen? We don't know. – DJClayworth Apr 18 '15 at 16:34
  • 3
    Frankly, depending on the exact details of your contract, the type of website it is, how long it's down and how much income the client loses during that time, you may be lucky if ALL they do is fire you. A lawsuit is not impossible. – keshlam Apr 19 '15 at 4:56

There are not many options. Get off workplace SE, grab a phone and call someone who has back up and restore it ASAP. Don't try to lie to cover it up, as it's quite obvious what happened (files don't disappear magically), mistakes happen. Apologize and assure that you will take measures to prevent it from happening ever again.

Lesson learned: next time make the backup as the first thing.

  • Yes i wull in future. But there is no backup from client's side. And i said previous developer doesnt have backup as he was done with it 5 years ago – 0____________0 Apr 18 '15 at 13:21
  • 4
    Oops, my bad, I read as the previous developer had a backup. If it was a simple static site, you can try google cache or wayback machine at archive.org – Gediminas Apr 18 '15 at 13:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.