chmod Entire Directories from the Command Line

This article demonstrates the process of chmod file and subfolder permissions per directory, using the command line.

If you have installed files which need mass permission modifications, all located in a similar directory on the server, you can use the command line to chmod and quickly fix the permissions. We will be using the find command in this process.

chmod Directory and Subfolders

First, login to the server via ssh. As the root user, execute a similar command, where /home/username/public_html/blog is the directory you are modifying permissions for:

# find /home/username/public_html/blog -type d -exec chmod 755 {} \;

This will modify permissions of /blog and all subfolders to 755 (drwxr-xr-x).

chmod Files Within Directory

As the root user, execute a similar command, where /home/username/public_html/blog is the directory you are modifying permissions for:

# find /home/username/public_html/blog -type d -exec chmod 644 {} \;

This will modify permissions of all files below /blog directory to 644 (-rw-r--r--).

Was this answer helpful?

 Print this Article

Also Read

Remove STRICT_TRANS_TABLES in SQL Mode for WHMCS

WHMCS requires a setting on the MySQL or MariaDB server for the SQL Mode. To verify this, log...

Install Python Interpreter on Ubuntu VPS or Dedicated Server

This article provides a step-by-step guide to installing the Python interpreter on an Ubuntu VPS...

Resolve "Configure: Error: No Acceptable C Compiler Found in $PATH"

When installing software to your Ubuntu VPS or Dedicated Server, you may encounter an error:...

How to Install Softaculous with cPanel/WHM

This guide will show you how to download and install Softaculous on your cPanel/WHM server. To...

Remove STRICT_TRANS_TABLES in SQL Mode for WHMCS

WHMCS requires a setting on the MySQL or MariaDB server for the SQL Mode. To verify this, log...