You are on page 1of 2

156

As you'll read on this answer on SO, this problem is not as hard as people are
making it. You can get the sudo command working again without a reinstall by
following these simple steps:

Log out as the current user, then log back in as root.


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

This does the trick and is much quicker and less painful than the "nuclear option"
recommended in other answers.

If your root password is not set, you can boot in Recovery Mode to set it.

Note that this will resolve the titular error /usr/bin/sudo must be owned by uid 0
and have the setuid bit set but if like the OP you did more than mess up the
permissions of the /usr/bin/sudo file, a more "nuclear" option may in fact make
more sense.

chown root:root /usr/lib/sudo/sudoers.so && chmod 4755 /usr/lib/sudo/sudoers.so;


chown root:root /etc/sudoers; chown root:root /etc/sudoers;

go to recovery mode by keep pressing Esc while booting the system.

select root option in long list you can see after entering into recovery mode
(it is actually root shell)

type command - mount -o remount / (Or in recovery you can click on grub option.
This helped me get read-write permissions on the file system. This basically
updated the read/write mode on the file system since the command wasn't working for
me initially)

It will remount your file system in read and write mode.

command - chown -R root:root /usr this command will change ownership from
"user" to root again recursively

now still i had problem with sudo command, so I again followed step 1,2,3 and
executed chmod 4755 /usr/bin/sudo

Now I really think that re-installing would have been really a "nuclear option"

Had the same issue on my droplet on digital ocean.

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. Below are
command that ive execute and reboot after.

chown -R root:root /usr/bin/sudo


chmod -R a=rx,u+ws /usr/bin/sudo
chown -R root:root /usr/lib/sudo/sudoer.so
chmod -R a=rx,u+ws /usr/lib/sudo/sudoer.so

Hope it helps.

You might also like