3

I just made a huuuge mistake. I typed the following as root:

chown chris ./

So it change perm to everything! Now I have problem booting because of these permissions. How do I fix it?

3
  • What you've written would only change the permission for the current directory. It wouldn't recurse onto subdirectories or other files. Please confirm this is the problem, and add what that directory was. There is no way to simply "undo" something like this, hence the detail is required.
    – Oli
    Oct 28, 2015 at 9:45
  • it was in home directory. Maybe it was /. instead. I typed it wrong, when I try use sudo it says that sudo must be owned by uid 0 Oct 28, 2015 at 9:52
  • use "history". It will show what you typed ;)
    – Rinzwind
    Oct 28, 2015 at 16:18

2 Answers 2

11

Given your response to the other answer, it sounds like you've run a very different command. Both /. ./ variants would be quite easy to reverse but it sounds like you've actually run something with recursion, like chown -r /.

This would systematically rewrite the permissions on the entire system. It's much more destructive and almost impossible for a beginner to unravel.

Assuming that's the case —or you're unable to confirm exactly what you did— my standing suggestion is you backup any data from a LiveCD and reinstall. It might sound a little severe but honestly, picking through every permission is really hard.

In comparison, reinstalling is very easy.
Even more so when you haven't been using Ubuntu for very long.

1
  • Yeah, I can imagine. Silly me, I think I run it with -r. Now I'm doing backup and reinstall. Cheers Oct 28, 2015 at 10:38
3

Boot into recovery mode: https://wiki.ubuntu.com/RecoveryMode

Mount / read-write and change the owner of / back to root:

mount -o remount,rw /
chown root /
2
  • I'm afraid still nothing ;/ Oct 28, 2015 at 10:21
  • This would work only if the OP didn't use -r, and in that case it wouldn't have had the error about sudo... reinstallation time...
    – Rmano
    Oct 28, 2015 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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