2

Somehow, permission in my Fedora got messed up. I don't see root is owner of /usr/bin/sudo directory and I am not able to execute any command using sudo. I am trying to find a solution but the solution I am seeing Ubuntu specific. Can some one please provide me steps to fix in Fedora.

Error:

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

I have already tried using:

chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo

but it didn't fix the issue.

Thanks in advance.

-- Update - The issue got fixed after upgrading my fedora.

  • 1
    I couldn't comment on your meta post since you deleted it within 2 minutes of asking, but: I was not the one who down-voted it there. – Jeff Schaller Jul 22 '17 at 12:37
4

this answer here is not the accepted one but it's the perfect one !

it says :

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.

if you can not acces the root user , then you will need a live cd or any linux os installed somewhere and use chroot !

update:

login as root and try the following cmds:

mount -o remount,rw /
mount --all
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
restart
| improve this answer | |
  • I used the command - chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo but somehow it didn't fix the issue. – Pinaki Mukherjee Jul 25 '17 at 11:44
  • what ls -ld / /usr/bin/sudo shows ? – Jonah Jul 25 '17 at 14:31
  • youness, I am accepting your answer as correct as your answer has mount commands also. My issue got fixed after I upgraded my Fedora. – Pinaki Mukherjee Jul 25 '17 at 20:11
  • i am glad you fixed the issue :-) – Jonah Jul 25 '17 at 20:52
1

If this is an important machine like a server or something, then you need to figure out what the hell happened and how to fix it correctly, but if it's just your personal computer or some hobby machine my answer should apply:

You need to become root somehow, can you use su or log in as root on a terminal or ssh root@localhost?

Then as root, chown root:root /usr/bin/sudo and chmod 4555 /usr/bin/sudo. I don't know much about sudo's implementation, but this should fix the thing the error complains about.

If you can't become root, you can boot up from a live CD and mount the harddrive somewhere, in which case the paths will be different.

| improve this answer | |
0

You need to:

chown 0 /usr/bin/sudo

chmod u+s /usr/bin/sudo

you need to do that as root. Maybe you should to do that from Recovery/LiveCD.

| improve this answer | |
0

I tried to set the permission correctly but still got the same error. At last I upgraded my fedora to latest version and it somehow fixed it.

chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo

The last option I had to mount the hard drive using recovery CD.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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