In another support article we talk about file and directory permissions. In the guide below we’ll cover how to change the file and directory permissions in bulk via FTP or the Terminal.
How to change file/directory permissions using FileZilla
Using FileZilla, connect to your account via FTP-SSL. Once connected, navigate to the files or directories for which you would like to change the permissions.
Since we want our files to have a specific set of permissions and our directories to have a separate set of permissions, we'll need to take an additional step here to help FileZilla make that distinction.
Files
Right-click on the name of the file you want to change the permissions for and click on File Permissions.
A new window will pop-up. In it, use the checkboxes to set the desired permissions or alternatively use the Numeric value text box and input the numeric value of the desired permissions. For files, we recommend using the 644 permissions value, which allows the file owner to Read and Write to the files, and the group and public roles to only Read.
If you want to apply the same permissions for all files inside the current directory, enable the Recurse into subdirectories option. Once ready, click OK.
Directories
Right-click on the name of the directory you want to change the permissions for and click on File Permissions.
A new window will pop-up. In it, use the checkboxes to set the desired permissions or alternatively use the Numeric value text box and input the numeric value of the desired permissions. For directories, we'll want to select the 755 permissions value so that the directory owner can Read, Write, and Execute, while the group and public roles can Read and Execute.
If you want to apply the same permissions for all directories inside the current directory, enable the Recurse into subdirectories option. Once ready, click OK.
The process can take several minutes if you are changing the permissions of a lot of files.
How to change file/directory permissions using the cPanel terminal
Another way to accomplish changing file permissions with FTP is without using a specific client, like FileZilla. Instead, you can always apply this change in your cPanel terminal using two simple find
commands.
To do this, you'll first need to go to your Terminal under the Advanced section of your cPanel dashboard.
Then, you may see a Warning screen, which you can move past by clicking I understand and want to proceed. As long as you follow these instructions carefully, your account will be fine.
Once you choose to proceed, you'll see a screen like the one below.
Here, you'll see your cPanel username followed by "@servername". In this instance, this account is on the pacman
server.
From here, you'll want to navigate to the folder the site you're working with is in, such as public_html if it's your main site, or the appropriate addon or subdomain folder.
cd public_html
Then, run the following find
commands.
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
Note: Do not run these commands at the root level of your cPanel, but in the folder that corresponds to the site you're working with.