How do you recursively adjust file and directory permissions?
$ find . -type f -exec chmod 644 {} \;
$ find . -type d -exec chmod 755 {} \;
$ chmod 707 images
$ chmod 707 images/stories
$ chown -R daemon:daemon cache
$ chown -R apache:apache cache
Setting permission to 0755 recursive :
$chmod -R 0755 directory_NameHere
To find all files in /home/user/demo directory
$ find /home/user/demo -type f -print
To find all files in /home/user/demo directory with permission 777, enter:
$ find /home/user/demo -type f -perm 777 -print
Apply new permission using the -exec option as follows:
$ find /home/user/demo -type f -perm 777 -print -exec chmod 755 {} \;
To select directories and subdirectories use the following syntax:
$ find /var/www/html -type d -perm 777 -print -exec chmod 755 {} \;
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND