How to change all file permissions in folder 644 in Linux

In Linux and Unix-like operating systems, file permissions are represented using a three-digit number, where each digit corresponds to a specific set of permissions:

  • The first digit represents the owner's permissions.
  • The second digit represents the group's permissions.
  • The third digit represents others' (everyone else's) permissions.

The numbers, 644, are octal representations of these permissions. In this case, 644 translates to:

  • Owner: Read (4), Write (2), No Execute (0)
  • Group: Read (4), No Write (0), No Execute (0)
  • Others: Read (4), No Write (0), No Execute (0)

So, 644 means that the owner of the file has read and write permissions, while the group and others have only read permissions.

You can use the chmod command in the Linux terminal to change file permissions. To change all files in the folder directory to have permissions 644 you can use the following command:


find /path/to/yourfolder -type f -exec chmod 644 {} \;

Here's what this command does:
find /path/to/yourfolder -type f -exec chmod 644 {} \;: This part of the command finds all files (-type f) within the yourfolder directory and its subdirectories and then executes the chmod 644 command on each file found. It sets the permissions of all files to 644.
Replace /path/to/yourfolder with the actual path.
Make sure you have the necessary permissions to perform these operations, or you may need to use sudo to run these commands as a superuser if required.

Comments

Leave a Reply