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.

- 17,888

- 11
-
@user535733 is this system problem can it be fixed by ovh – marotox123 Dec 17 '22 at 20:39
-
1Also see: https://askubuntu.com/a/884657/158442 – muru Dec 18 '22 at 05:31
1 Answers
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.

- 17,888