Ask Your Question

Changing Back Ownership of /usr/bin

asked 2018-12-06 21:05:23 -0500

MikeZuccaberg gravatar image

updated 2018-12-10 14:04:33 -0500

hhlp gravatar image

Hey guys, I changed the permissions for this folder in order to patch something within, not realizing that this would break sudo and seemingly the system in general. Is there any way to fix this without a complete reinstall? I am able to boot Fedora from a flash drive and get into the folder, but so far my attempts to change the ownership back to root have been unsuccessful. I can't find anything on Google that will work, either.

The exact error it's giving me is pasted below. Thanks!

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
edit retag flag offensive close merge delete


You should reboot and go into rescue mode, then change what you did

aeperezt gravatar imageaeperezt ( 2018-12-06 21:07:14 -0500 )edit

Recovery mode doesn't seem to have any effect. I know I'm in it because it disables the wifi, but other than that I get the same errors.

MikeZuccaberg gravatar imageMikeZuccaberg ( 2018-12-06 21:14:40 -0500 )edit

When you're in rescue mode, you're running as root, and don't need to use sudo.

sideburns gravatar imagesideburns ( 2018-12-06 22:53:26 -0500 )edit
Panther gravatar imagePanther ( 2018-12-07 08:31:41 -0500 )edit

Nice thought, @Panther, but the poster managed to change the permissions for /usr/bin itself not for a single package.

sideburns gravatar imagesideburns ( 2018-12-07 13:20:49 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2018-12-07 12:49:50 -0500

ed209 gravatar image

You did a big mess. Before reinstalling, because who knows what else have you done, start with a live image, and then change permission accordingly.

edit flag offensive delete link more


Yes, that's probably the best idea now. Just be sure to back up /home, even if it's on a separate partition, just to be safe.

sideburns gravatar imagesideburns ( 2018-12-07 13:22:49 -0500 )edit

@sideburs, you're quite optimistic. Maybe even home has been patched.

ed209 gravatar imageed209 ( 2018-12-07 13:51:29 -0500 )edit

So you think the poster should throw away all of his personal files just because /home might have been affected? Isn't that just throwing the baby out with the bathwater?

sideburns gravatar imagesideburns ( 2018-12-07 14:18:56 -0500 )edit

Hm. From when sarcasm has became an unknown? :-(

ed209 gravatar imageed209 ( 2018-12-07 19:03:14 -0500 )edit

Sarcasm is never appropriate if the person you're trying to help might take you literally.

sideburns gravatar imagesideburns ( 2018-12-07 19:14:40 -0500 )edit

answered 2018-12-06 23:41:43 -0500

Nicholas gravatar image

Try: (if you have access to su)

 su - root

These are pretty close to the os defaults, but you could make them more restrictive. (umask 027)

chown -R root:root /usr/bin
find /usr/bin -type d -exec chmod 0755 {} \;
find /usr/bin -type f -exec chmod 0755 {} \;
chmod 0666 /usr/bin
chmod 4111 /usr/bin/sudo
chmod 4755 /usr/bin/su
chmod 4755 /usr/bin/umount
chmod 4755 /usr/bin/pkexec
chmod 4755 /usr/bin/passwd
chmod 4755 /usr/bin/gpasswd
chmod 4755 /usr/bin/newgrp
chmod 4755 /usr/bin/at
chmod 4755 /usr/bin/crontab
chmod 4755 /usr/bin/chage
chmod 4711 /usr/bin/chfn
chmod 4711 /usr/bin/chsh
chmod 2755 /usr/bin/write && chown root:tty /usr/bin/write
chmod 2755 /usr/bin/screen && chown root:screen /usr/bin/screen
chmod 2711 /usr/bin/locate && chown root:slocate /usr/bin/locate
chmod 0644 /usr/bin/redhat_lsb_init

- or -

Once in recovery mode drop to the shell.

mount -o remount,rw /
chown root:root /usr/bin/sudo
chmod 4111 /usr/bin/sudo

edit flag offensive delete link more


How do I drop to the shell? Also, recovery mode is the same thing as rescue, right? Thanks

MikeZuccaberg gravatar imageMikeZuccaberg ( 2018-12-07 00:17:57 -0500 )edit

Yes, they're two ways of saying the same thing. Also, su defaults to root, so using su - root is slightly redundant, although it doesn't hurt.

sideburns gravatar imagesideburns ( 2018-12-07 00:34:35 -0500 )edit

Question Tools


Asked: 2018-12-06 21:05:23 -0500

Seen: 124 times

Last updated: Dec 07 '18