I have several folders in a directory with various permissions such as 555,, 700, 755, 777 etc. I want to change permission of all folders with permission 777 to 755. In this guide, we’ll learn how to change the permission of all directories with 777 to 755 using SSH.
Navigate to the target directory
Let’s suppose I want to modify permission of the folders in /home/ravi/public_html directory. First, connect to your server via SSH and navigate to that directory: /home/ravi/public_html.
cd /home/ravi/public_html
Change Directory Permission
Below command will find all folders in the current directory and all its sub-directories with permission 777 and change them to 755. Folders with other permissions will remain unchanged.
find . -type d -perm 0777 -exec chmod 755 {} \;