0

I am working with digital ocean and WordPress. I have uploaded my theme and my file permissions are all wrong. I know how to set the file permissions individually using ssh but I'm wondering if I can do multiple at once rather than doing each individually. I want to set all folders inside my theme to 755 and all files to 644 (correct me if this is wrong)

Here's what I have done so far; I navigated to my theme folder using ssh then used to following command to set file permissions;

chmod 644 file.php
chmod 755 folder
mujuonly
  • 11,370
  • 5
  • 45
  • 75
Reece
  • 2,581
  • 10
  • 42
  • 90
  • Duplicate from https://stackoverflow.com/questions/3740152/how-to-change-permissions-for-a-folder-and-its-subfolders-files-in-one-step – Zoran Ilic May 25 '22 at 12:33

2 Answers2

1

chmod -R 755 will set these permissions to all files and subfolders in the tree. To set the directories to 755 and either leave the files alone or set them to 644. For this, you can use the find command. For example:

To change all the directories to 755 (drwxr-xr-x):

find /opt/lampp/htdocs -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r--r--):

find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
mujuonly
  • 11,370
  • 5
  • 45
  • 75
-1

Please try below command for directory

find /var/www/html/ -type d -exec chmod 755 {} \;

Below command is for files permission

find /var/www/html/ -type f -exec chmod 644 {} \;

yogesh
  • 84
  • 4