How to change the permissions of files in a directory recursively

Robert Heller heller at deepsoft.com
Mon Apr 24 19:10:38 UTC 2017


At Mon, 24 Apr 2017 13:16:13 -0500 "Ubuntu user technical support,  not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:

> 
> How can I leave the permission of a directory at 755 and change the 
> permissions of all of it's files to 766? Everything I have tried and 
> what I have found googling ends up setting the dir and file permissions 
> the same.

Probably suggesting the (obvious/simpleminded) 'chmod -R 766 /some/dir'.

> 
> So if I have /var/www/html/foo/  I want foo to remain at 755 and files 
> in foo to change to 766.

find /var/www/html/foo/ -type f | xargs chmod 766

(you might need to use sudo on the xargs command and/or the find command, 
depending on what user your current shell is running under and what the 
current permissions are.)

Alternitively (for completeness):

chmod -R 766 /var/www/html/foo
find /var/www/html/foo/ -type d | xargs chmod 755

> 
> Thanks,  Jim
> 
> 
> 

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services
                                                                                       




More information about the ubuntu-users mailing list