Score:0

How to recover from running "chown -r ubuntu /"

kw flag

I ran chown -r ubuntu / on my system, and everything is gone. Is there any way to recover? This is a server server hosted on OHV.

marotox123 avatar
kw flag
@user535733 is this system problem can it be fixed by ovh
muru avatar
us flag
Also see: https://askubuntu.com/a/884657/158442
Score:2
vn flag

There are (at least) two scenarios:

  • You ran this as a regular user (not sudo) and you have locked yourself out of your account on the server (plus probably also caused some collateral damage).

  • You ran this as root and have made the entire system unbootable.

In either case, the data is likely still there, but you'll need a way to access the system. Most cloud hosting providers have the ability to boot into a "recovery" or "rescue" mode, and OVH is no exception. See their rescue mode documentation here, and search their help for "rescue mode" for other documents.

I don't use OVH, so I'm going to run through the general recovery concept here based on my experience with other hosting providers. You'll probably need to do something like:

  • Boot into rescue mode
  • Examine the damage (system files or user files)
  • Repair if possible (see this answer which @muru linked in the comments), which may return you to a bootable system.
  • Regardless, it may be difficult to ensure that you've properly reset all files. Your best bet will still be to backup, reinstall, and recover.

If you cannot return the existing install to a bootable state ...

  • Add storage to your server (this will likely be an additional charge)
  • Create a new disk in that storage.
  • Boot into rescue mode
  • Copy over any critical data from the old disk to the new.
  • Reinstall Ubuntu on the old disk.
  • Copy the backed-up data back to the newly installed system.
  • Delete the new drive
  • Drop back to your normal storage tier.

Alternatively:

  • Add storage to your server (this will likely be an additional charge) that is equivalent to what you already had.
  • Create a new drive in that storage.
  • Install Ubuntu on the new disk.
  • Set the new disk to be the boot drive for the server.
  • Boot into the new Ubuntu.
  • Mount the old drive into something like /mnt/old
  • Copy the critical data from the old drive to the new one.
  • Delete the old drive
  • Drop back to your normal storage tier.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.