Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a shell command to recursively give permission to directories and files?

Can someone please give me a recursive command that will go through a directory and make all normal files permission 644 and all sub directories 755?

I am really getting tired of doing this manually every time I have to install something on my host. I don't know enough BASH (Shell?) command to do this.

like image 688
Abs Avatar asked Mar 09 '09 22:03

Abs


1 Answers

There is X option for that.

chmod a+X * -R

This will give execute bit only to directories, not files. To set 644, 755, respectively with one command, use:

chmod a=rX,u+w <files/dirs> -R
like image 111
ypnos Avatar answered Nov 15 '22 09:11

ypnos