I am writing this in conjunction with the setup of a new Drupal 10 site on my local. The setup is a little different than the instructions call for because I am doing the setup within Lando. This means that the permissions didn't come out right and editing the site files directly on my machine leads to having read-only access.
Work done here is on Mac OS X 13.5 Ventura. But should apply to any Mac or Linux machine.
To resolve that, I did the following things after the initial site setup with composer within Lando:
- First, I checked the directory permissions. You can do that with
stat -f '%A %N' *
. - That shows me the permissions in numerical format. All the files should be 644 and the directories be 755.
- Next, we need to correctly set the directory permissions. Go into the site root directory (where the "vendor" directory sites).
- Then set the correct directory permissions with:
find . -type d -exec chmod 755 {} \;
- Now set the correct file permissions with:
find . -type f -exec chmod 644 {} \;
- If these very quickly return then you likely need to run them with
sudo
at the beginning of the command to override existing permissions.
Thats it, your files and directories should now show the correct permissions.
References: