Search code examples
sudofedorafedora-33

Is there a way to fix all permissions of the directory on Fedora?


I accidentally broke the file permissions of /usr using chmod. There is X on each folder and when I try to open it shows like this:

enter image description here

Now I can not use sudo to fix it because it gives this error:

sudo: error in /etc/sudo.conf, line 14 while loading plugin "sudoers_policy"
sudo: /usr/libexec/sudo/sudoers.so must be owned by uid 0.
sudo: fatal error, unable to load plugins

I also can not use chmod in /usr file since it needs sudo.

Is there a way to fix all permissions of the file?


Solution

  • Boot from Live Fedora USB

    Locate /run/media/VOLUME_NAME of the Linux HDD

    #su 
    #mount -o remount,rw /run/media/VOLUME_NAME 
    #chown root:root -R /run/media/VOLUME_NAME/usr 
    #chmod 4755 /run/media/VOLUME_NAME/usr/bin/sudo 
    

    Then reboot to the OS

    #sudo rpm --setugids –a 
    #sudo rpm --setperms -a