Changing File Permissions via FTP or the Terminal

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.

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.

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.

Capture_2023-04-14_12.48.37.png

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.

Screenshot_2023-04-18_at_1.26.07_PM.png

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.

Screenshot_2023-04-18_at_1.29.50_PM.png

Once you choose to proceed, you'll see a screen like the one below.

cpanelterminal.png

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.

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

Reclaim Hosting Support Hours
8:00 am - 5:00 pm ET, Monday through Friday
Submit a Ticket
Get a quick and helpful response from the pros.
Need Extra Support?
No problem, we're here to help! Talk to us about Professional Services or custom Service Level Agreements.