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?

Oli
  • 293,335
  • 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 '15 at 09: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 – Gervazy Lolex Oct 28 '15 at 09:52
  • use "history". It will show what you typed ;) – Rinzwind Oct 28 '15 at 16:18

2 Answers2

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.

Oli
  • 293,335
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 /