This question already has an answer here:

I am using Ubuntu 17.04.

By mistake, I have changed the ownership of sudo. So now I can't make any changes as the chown command I could use to fix it needs sudo.

If I use sudo I get

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

marked as duplicate by mikewhatever, wjandrea, muru, karel, Eric Carvalho Oct 27 '17 at 9:54

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 really just changed the ownership of the sudo command--that is, the file /usr/bin/sudo--then you can fix this by using pkexec instead of sudo to run chown and change the ownership back. This command does that:

pkexec chown root: /usr/bin/sudo

pkexec will prompt you for your password (as would sudo if you were able to run it).

root: means the same thing as root:root, in case you had changed the group owner as well.

If you have changed the ownership of many more files besides /usr/bin/sudo, and in particular if you have changed the ownership of all files in /usr/bin (which would also happen if you changed permissions on / or /usr but passed the -R flag to chown, specifying recursive operation), then that will not be sufficient. But based on the description you have given in the question--that you have specifically changed the ownership of /usr/bin/sudo--running that one pkexec command should be sufficient.

  • " pkexec must be setuid root " This is the reply i am getting.... – Souvik Brahma Oct 27 '17 at 6:09
  • @SouvikBrahma This means you have changed the permissions or ownership of files other than /usr/bin/sudo (see my last paragraph). For reasonable advice to be given, it will be necessary for you to say more about what you actually did that resulted in the ownership of files being changed, including whatever commands you ran. (The history command may help in showing what you've run.) If you edit your question to include this information, then it should be possible to provide a more effective answer or to close the question as a duplicate of a question with an answer that will help. – Eliah Kagan Oct 27 '17 at 6:12
  • " sudo chmod +r /usr/lib/node_modules/ " && " sudo chmod +w /usr/lib/node_modules/ " are the commands that i executed – Souvik Brahma Oct 27 '17 at 6:16
  • @SouvikBrahma Please edit your question. You can paste each command you ran on its own line and indent them by 4 spaces to make them look right. (Pressing Ctrl+K , or clicking {}, will do this to text selected in the visual editor.) Though possible, it's hard to show commands unambiguously in a comment, and you haven't done so. Is that one command with " marks and && in it? Is it two commands where "&&" just means "and"? Might they be wrong by even one character? It's unclear why those commands would cause the problem you are experiencing. – Eliah Kagan Oct 27 '17 at 6:22
  • Eliah Kagan, thanks a lot, I have got my solution by logging in as root, and then using chmod ...... Thanks Again – Souvik Brahma Oct 27 '17 at 9:14

Use a Live CD to mount your system's root partition and fix the permissions from there.


Your permission should be like following:

$ ls -l /usr/bin/sudo 
-rwsr-xr-x 1 root root 155008 May 29 15:49 /usr/bin/sudo

To do change it as default, please login with root user first and change the ownership for sudo "/usr/bin/sudo".

  • 1
    This can work on Ubuntu systems where the user has already enabled root logins, but unfortunately it won't work on most Ubuntu systems because most users do not do this and logging in as root is not enabled by default in any version of Ubuntu. However, the permissions could still be changed from recovery mode. – Eliah Kagan Oct 27 '17 at 5:37

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