Modify Directory and Subdirectory Permissions


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 Subdirectories

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 f -exec chmod 644 {} \;

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

  • chmod, file permissions, manage directory permissions
  • 177 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Related Articles

Forcefully Delete an IP Address from SolusVM

If at any point you find you have an orphaned ipaddress, you can delete it by running the...

Do You Offer a Hardware Firewall Solution?

Yes, we have a very limited selection of hardware firewalls available. We appreciate the specific...

View Server PHP Environment with phpinfo.php

The phpinfo() function outputs a huge amount of information about the system you're using, such...

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...