How to change the permissions of files in a directory recursively
Robert Heller
heller at deepsoft.com
Mon Apr 24 22:11:34 UTC 2017
At Mon, 24 Apr 2017 16:53:04 -0500 "Ubuntu user technical support, not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:
>
> 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.
That would have *failed* to change dotfiles (.htaccess for example). It would
also have changed and the *subdirectories* to 766 -- I don't know if that is
your intent or not.
>
> Regards, 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