How to change the permissions of files in a directory recursively
Jim
jf_byrnes at comcast.net
Mon Apr 24 21:53:04 UTC 2017
On 04/24/2017 02:10 PM, Robert Heller wrote:
> 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
>
Robert, thanks for the reply. Earlier it was suggested that I add a *
after foo/ and that seems to have worked for me.
Regards, Jim
More information about the ubuntu-users
mailing list