15

I stupidly ran sudo chown -R carlos:carlos / and carlos is my user. This changed all files to be Carlos and I could not boot up again (because the root files were now owned by #1000) and I cant get sudo acess in live cd (because the owner of /usr was changed to my user). Can anyone help me? FYI I have mounted my hard drive.

jrg
  • 61,707
ccrama
  • 435

3 Answers3

11

You could spend a bunch of time trying to repair this, your best bet is to just reinstall over your existing installation and doublechecking that you don't format the partition.

You'll lose the packages you have installed and have to reinstall them, but it's much less work than reconstructing the permissions on your system.

Jorge Castro
  • 73,717
10

It worked from me, hope it helps someone. If this doesn't work reinstall is always an other option.

On booting time:
Select Advanced Options for Ubuntu.
Switch to ubuntu recovery mode.
Select root option from the list of Options.
Enter the commands below:

mount -o remount,rw / mount --all chown root:root /usr/bin/sudo chmod 4755 /usr/bin/sudo restart

2
  1. Boot into recovery mode (follow 1 to 8 from this link). Item 8 is very important.

  2. By typing in the root terminal there, change the ownership of the sudoers.so file: chown 0 /usr/lib/sudo/sudoers.so.

  3. Then chmod 644 /usr/lib/sudo/sudoers.so.

  4. Restart your computer.

Zanna
  • 72,312