1

After running the (stupid) command :

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

Having $(npm config get prefix) being equal to /usr, I have changed the ownership of /usr/bin/sudo to my administrative user. Now when I try to sudo I get the following error :

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

It was a fresh Ubuntu installation so I don't mind reinstalling but if there is another way I'm in. Note that I had not set a password for root so I believe I have no way to login as root. If I could it would be great, I would just chown -R root:root /usr/bin and it would fix my problem.

My /etc/ folder is still owned by root and everything works fine except sudo giving the above error message.

Mouradif
  • 119
  • Please re-install easiest that way since its a new install! – George Udosen Oct 09 '17 at 12:07
  • 1
    @Zanna thank you for the link but these are 2 very different issues. I'm not talking about /etc but /usr, my principal problem is that /usr/bin/sudo is now owned by another user than root – Mouradif Oct 09 '17 at 12:56
  • the principle is the same. There's lots of stuff in /usr and you ran with the -R flag. sudo doesn't work if you chown /etc. Use this procedure and replace /etc with /usr in the commands – Zanna Oct 09 '17 at 12:58
  • Boot from a LiveUSB, mount your disk on /mnt. Now change the ownership of /mnt/usr/bin/sudo. Reboot the machine, see if sudo is error free now. –  Oct 09 '17 at 18:29
  • I agree with WillemK as one needs to have experience with using LiveCD systems to fix all sorts of stupid things we (or others) do. – jpezz Oct 09 '17 at 20:53
  • 1
    WillemK's suggestion is incomplete. Fixing ownership of /usr/bin/sudo is not enough. And obviously the linked post suggests booting a live session, because there's no other way to fix it – Zanna Oct 10 '17 at 05:21

0 Answers0