0

I stupidly ran this command in Ubuntu 18.04:

sudo chown -R $USER:$USER /usr

Now I want to undo this but when I run:

chown -R root:root /usr

I get this error:

operation not permitted

And I can't run a sudo command and gives me this error:

/usr/bin/sudo must be owned by uid 0 and setuid bit set

How can I fix this?

Kulfy
  • 17,696
fjahan
  • 1

1 Answers1

2

You have to boot in maintenance (recovery) mode or with live CD / USB and mount the root volume.

FedKad
  • 10,515
  • Can you give more details of how to fix this in recovery mode? – fjahan May 16 '19 at 08:30
  • See the link I provided. After step 9, enter your chown -R root:root /usr and reboot. – Jos May 16 '19 at 08:59
  • That won't fix the files owned by root, but in one of the cricket, crontab, dip, mail, messagebus, mlocate, postdrop, shadow, ssh, tty or utmp groups. Many strange failures are in your future. – waltinator May 16 '19 at 17:24