How to change file permissions recursively using Chmod in Linux?

Chmod is an Unix command that allows users to change permissions of files and directories. You can use it recursively or non-recursivey, depending on your needs, but there are some things you need to know about the recursive mode. This tutorial will teach you how to use Chmod in a recursive way without any help from additional commands such as find and xargs.,

The “linux change folder permissions from root to user” is a question that has been asked many times. In this article, I will show you how to do it with the command line tool called “chmod”.

If you use Linux, you’re going to run into permission difficulties at some point. In most cases, these issues may be fixed by giving the file you’re attempting to alter the proper user rights or ownership.

In this tutorial, we’ll look at how to use the chmod command in Linux to recursively alter permissions on files and directories.


The chmod command in Linux allows you to modify file permissions. Permissions may be given in either a symbolic or numerical format. Because the command only works on files, you’ll have to use the –R or (–recursive) parameter to modify the permissions of a whole folder.

The chmod command has the following general syntax.

[permissions] chmod -R [directory]

When you’re operating a local web server on your Linux system, maybe the most common situation for modifying file permissions is. You’ll need to adjust a few file permissions to make them viewable across your local network in this situation. The chmod command will be used as follows.

/var/html/www/chmod -R 755

The permissions are represented by 755 in the command above. In symbolic mode, the same permissions might be mentioned as follows.

/var/www/html/chmod -R u=rwx,go=rx

Keep in mind that file permissions may only be changed by the root owner or users with sudo rights.

In the samples above, u stands for the current user, g for the group, and o for the others. The letters r, w, and x stand for read, write, and execute permissions, respectively. = creates a new permission, + adds a permission, and – revokes a permission.

Permissions and owners are defined by numbers in numeric mode. The numerical representation of each number is shown below.

  • 0: There is no authorization.
  • 1: Put it into action
  • 2: Write
  • 4: Read

The sum of values for a given user class represents the authorization number for that group. If you wish to provide a user read, write, and execute rights, for example, the permission number is 4+2+1 = 7.

As a result, the user in the examples has read, write, and execute rights, but the group and owner only have read and execute capabilities.

Also see: What Does the Linux Booting Process Entail?


If you want to alter the permissions of a certain file type inside a folder, you’ll need to use the search command to locate the file and then use chmod to change the permissions.

Using our webserver as an example, here’s how you’d modify all files with permissions of 644 to 755.

find /var/www/html -type d -exec chmod 755; find /var/www/html -type f -exec chmod 644; find /var/www/html -type d -exec chmod 755; find /var/www/html -type f -exec chmod 644;

The same thing may be done in symbolic style, as seen here.

find /var/www/html -type d -exec chmod u=rwx,go=rx; find /var/www/html -type f -exec chmod u=rw,go=r; find /var/www/html -type f -exec chmod u=rw,go=r;

See also: How to rename a directory in Linux.

When he’s not writing/editing/shooting/hosting all things tech, he streams himself racing virtual vehicles. Yadullah may be reached at [email protected], or you can follow him on Instagram or Twitter.

Watch This Video-

chmod recursive directories and files” is a command that allows users to change file permissions recursively. This can be done by using the “chmod” command with the “-R” option. The “-R” option means that it will apply to all directories and files in the current directory.

{“@context”:”https://schema.org”,”@type”:”FAQPage”,”mainEntity”:[{“@type”:”Question”,”name”:”How do I change permissions on a Linux file recursively?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”A: Use the following command to change permissions on a file recursively:
sudo chmod 666 filename”}},{“@type”:”Question”,”name”:”How do you apply chmod 777 recursively?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”A: chmod 777 recursively is usually used to change permissions of directories and files. It changes the permission setting on all folders and data within that folder and can also be applied to individual items in a given directory.”}},{“@type”:”Question”,”name”:”How do I change permissions in Linux chmod?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”A: There is no way to change permissions in Linux chmod.”}}]}

Frequently Asked Questions

How do I change permissions on a Linux file recursively?

A: Use the following command to change permissions on a file recursively:
sudo chmod 666 filename

How do you apply chmod 777 recursively?

A: chmod 777 recursively is usually used to change permissions of directories and files. It changes the permission setting on all folders and data within that folder and can also be applied to individual items in a given directory.

How do I change permissions in Linux chmod?

A: There is no way to change permissions in Linux chmod.

Related Tags

  • chmod 777
  • chmod recursive directories only
  • chmod 777 recursive
  • chmod recursively
  • chmod command in linux
You May Also Like