I was trying to install something and accidentally run following command.

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

Now I am getting error when trying sudo -i.

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

I have tried recovery mode and
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo but nothing is working.

marked as duplicate by Florian Diesch, vidarlo, waltinator, pomsky, user68186 Feb 8 '18 at 17:48

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.


If you have a root password, you could try to logon as root and fix the permissions as root. Else boot from Linux live CD, ceome root there, mount the partition with your broken system, set correct permissions again there.

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