Changing file and directory permissions in Linux is simple
Permissions can be weird when moving folders and creating files either with SSH or FTP. If you run into an issue where you need to change many directories (folders) and files at the same time, follow the examples below.
We will be using the chmod command, and I am assuming you are using linux and SSH or terminal.
For changing permissions on a single directory or file, we typically use the following format:
chmod 777 file.txt
where 777 is read, write, and execute for owner group and other (everyone)
However, there is another format we can use:
chmod a+rwx file.txt
or chmod ug+rwx,o+rx file.txt
where r=read, w=write, x=execute, u=owner, g=group, a=all, +=add
With this format, we have more control over the specific permissions of files and directories.
For example, most websites should be set up with directories having 755 permissions, and files having 644 permissions. However, the site I just created using Drush, just set all of my folders to 775, and files to 664, which means group has write permissions in addition to the standard permissions. My web host doesn't allow files to be writable by group so I can change all directories and files with the following command.
chmod -R g-w *
-R= recursive (all folders, sub-folders, and files) g=group -=remove, w=write, *= every file and folder
Essentially I am telling it to remove the write permission for group from every file, folder, and subfolder.
WARNING: If you run this command, make sure you are in the directory you want to change permissions for, otherwise you could really mess up your permissions.
NOTE: Use at your own risk, make sure you back up your data before making a major change like this, I can not be held liable for any damages you incurr as a result of following these examples.