How to change the permissions of files in a directory recursively

Kleber Leal kleber.leal at gmail.com
Tue Apr 25 14:11:40 UTC 2017


You can use the find command to select only directories or files.

find /your/dir -type d -exec chmod 755 {} \;
find /your/dir -type f -exec chmod 766 {} \;

Where type d if for directories and f is for files.

Kleber

Em 24 de abr de 2017 15:28, "Chris Green" <cl at isbd.net> escreveu:

> On Mon, Apr 24, 2017 at 01:16:13PM -0500, Jim 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.
> >
> > So if I have /var/www/html/foo/  I want foo to remain at 755 and files in
> > foo to change to 766.
> >
> I'm not sure if it's *exactly* what you're after but take a look at
> the difference between 'x' and 'X' in the man page for the chmod
> command.
>
> --
> Chris Green
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
> an/listinfo/ubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20170425/720b0bbd/attachment.html>


More information about the ubuntu-users mailing list