What's new
  • Welcome to PHCorner forums. Take a moment to sign up and gain unlimited access and extra privileges that guests are not entitled to, such as: All that and more! Registration is quick, simple and absolutely free. Join our community today!

Tutorial How to set chmod for all folder only and all of its subfolders and files in linux ubuntu terminal?

Status
Not open for further replies.

Draft

Administrator
Joined
Jan 23, 2011
Messages
11,198
Solutions
10
Reaction
42,829
The answer above is correct, in that chmod -R 755 will set this as permissions to all files and folders in the tree. BUT WHY ON EARTH WOULD YOU WANT TO? it might make sense for the directories, but why set the execute bit on all the files?
i suspect what you really want to do is set the directories to 755 and either leave the files alone or set them to 644 for this you can use the find command e.g.
to change all the directories to 755:
Code:
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
to change all the files to 644:
Code:
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;
 
Status
Not open for further replies.

Online statistics

Members online
1,607
Guests online
2,104
Total visitors
3,711

Forum statistics

Threads
843,711
Messages
16,682,498
Members
1,466,347
Top