The basic problem with this is that, by removing the execute permission bit from all top level directories, you have actually denied access to all files below those directories and consequently now you cannot execute any commands. (Except built-in commands of your shell, but those won't save you.)
The easiest way out I can imagine is:
- boot a live system from a CD or a USB thumbdrive
- mount your root filesystem at /mnt
- set the execute permission bits again with
sudo chmod a+X /mnt/*
Note the capital X which will make sure that only directories will get the permission bit set.
Also note that on a standard Ubuntu installation there are two top-level directories (/lost+found
and /root
) which don't have execute permission for everybody. You can fix that later when your system is usable again.
/usr/bin/sudo chmod ...
would be sufficient to fix it? – steeldriver Feb 23 '22 at 22:22...
with - unfortunately there's no blanket "undo" for this, you'd need to look at what the correct permissions of each directory (and file - if there are any in/
) should be – steeldriver Feb 23 '22 at 22:43