0

I chowned -R username /usr/lib and now i cannot sudo or do any thing really due to sudoers.so belonging to username.

How do i fix this and make /usr/lib owned by root again?

3 Answers3

1
  1. Reboot the system to enter grub. Select recovery mode. Enter root shell
  2. Remount the system with read/write permissions: mount / -o rw,remount
  3. Run chown -R root:root /usr/lib. Once done, reboot.
A.B.
  • 90,397
Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • This is not right..not all the direcories/files under /usr/lib are root owned so simply running chown again won't resolve this..this is a failrly complex situation.. – heemayl Jun 19 '15 at 18:43
  • @heemayl I've ran ls -l /usr/lib/* | less all files are owned by root. group ownership was all root, except drwxr-xr-x 2 root utempter 4096 Feb 18 21:48 utempter. For that directory the group ownership was root. That's all. This should fix most of the problem – Sergiy Kolodyazhnyy Jun 19 '15 at 19:19
  • You are doing recursion..there are thousands of files under that sublevel..how can you be sure of them all? – heemayl Jun 19 '15 at 19:22
  • find /usr/lib -ls | awk '{print $5" "$6}' | grep -v root also no problem – Sergiy Kolodyazhnyy Jun 19 '15 at 19:23
0

Try with one of the following :

sudo chown [USERNAME]:root /usr/lib

Or

sudo chmod 0755 /usr/lib

Use option -R with chown if its just for recursive.

  • sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0 sudo: fatal error, unable to load plugins

    this is the error it gives me. I also cannot boot into recovery mode by holding shift. I think its because this instalation has been done on top of a w8 OEM laptop.

    any ideas?

    – Henrik Harju Dec 12 '13 at 17:35
  • No. Someone has given that file ownership to the user with chown without -R. Before reinstall, just try with pkexec chown root /usr/lib/sudo/sudoers.so or pkexec chmod go-w /usr/lib/sudo/sudoers.so –  Dec 12 '13 at 17:54
0

It's very easy! Boot with Instalation CD (Ubuntu), and go to /media/ubuntu/(your disk Ubuntu), then execute:

sudo chown root -R /usr/lib
heemayl
  • 91,753
  • 2
    This is not right..not all the direcories/files under /usr/lib are root owned so simply running chown again won't resolve this..this is a failrly complex situation.. – heemayl Jun 19 '15 at 18:42