0

I accidentally ran sudo chown -R -v myuser:myuser /, essentially transferring sudo to my own user by mistake. I meant to only take the current directory.

How do I recover from this? I stopped it after a few seconds, but running anything with sudo now gives me:

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

marked as duplicate by Byte Commander, Eric Carvalho, muru, karel, Zanna Dec 19 '17 at 12:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I've attempted it and I can't boot now. Stuck at spinning wheel. – cbll Dec 18 '17 at 20:28
  • It's stuck on "a start up job is running for hold until boot proceeds finishes up" been there for 5 minutes – cbll Dec 18 '17 at 20:35
  • 1
    I vote not a duplicate because this is about chown rather than chmod. Even though the solution (reinstall) may be the same and it's in the same general category of questions, people will be encountering this independently of the chmod issue and it may even have different symptoms or error messages. – thomasrutter Dec 18 '17 at 23:21
  • @thomasrutter "people will be encountering this independently of the chmod issue and it may even have different symptoms or error messages" isn't that the very reason to close it as a dupe? More signposts to the same problem? – muru Dec 19 '17 at 1:03
1

There is no way to recover from this that is simpler than a reinstall. It is not the case that all system files simply need to be owned by a particular user, or root, or even that they follow a pattern. There are many files and directories throughout the system that rely on being owned by particular special purpose accounts.

In theory you could compare the ownership (user and group) of every file on your system to the ownership in a fresh install of Ubuntu, writing a script to replicate that ownership information. But even that is fiddly and prone to edge cases. Because this involves installing Ubuntu anyway, you may as well just reinstall.

0

I see duplicates.

Have you tried https://askubuntu.com/a/471503/772996

  1. Log out as the current user, then log back in as root.
  2. Execute chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
  3. Log out as root, then log back in as the current user.

But maybe to have a clean installation you should reinstall properly.

  • It won't boot at all for me. So I can't log in as normal user. – cbll Dec 18 '17 at 21:43

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