Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting file permission for Files and Directories [closed]

I need to apply below permission policies to my files under www folder

664 to all files in www recursively, 755 to all directories under www recursively

I tried

find . -type f -exec chmod 644 {} ; 
find . -type d -exec chmod 755 {} ; 

But always getting error

find: missing argument to `-exec'

What is the solution?

like image 247
Mithun Sreedharan Avatar asked Dec 23 '22 07:12

Mithun Sreedharan


1 Answers

Backslash before semi-colon (or quotes around it):

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;

The shell sees the semi-colon you typed as the end of the command and does not pass it to find, which then complains that it is missing.

like image 141
Jonathan Leffler Avatar answered Dec 29 '22 10:12

Jonathan Leffler