Mailinglist Archive: opensuse (3441 mails)

< Previous Next >
Re: [opensuse] Correct Way to Recursively Change Permissions
  • From: Randall R Schulz <rschulz@xxxxxxxxx>
  • Date: Tue, 13 Jan 2009 18:29:34 -0800
  • Message-id: <200901131829.34973.rschulz@xxxxxxxxx>
On Tuesday January 13 2009, Henare Degan wrote:
On Wed, Jan 14, 2009 at 12:42, Cristian Rodríguez
<crrodriguez@xxxxxxx> wrote:
find /path/of/directory -type f -exec chmod 600 {} +

Thanks very much to everyone that responded. I always thought there
was an option of chmod (or similar) that did not change the 'x' bit
on directories but I guess not.

I found Cristian's solution the most elegant (I even learnt a bit
more about the -exec option of find, after bothering to read the man
page to understand what the curly braces and plus did at the end of
the command).

Randall, using the symbolic mode versus numeric mode doesn't change
how the command affects directories versus files (although I may have
missed the point you were making in your mail ;)

% chmod -R o+rw /path/of/directory

If an entry has execute bits, it will keep them, if it doesn't, it won't
get them.

Isn't that what you want?

If there are a lot of files in the hierarchy, all the solutions based on
the -exec option to find will be significantly slowed because a fork /
exec pair will have to happen for each file. With a recursive use of
chmod a single process will do all the work, which is far more

Thanks again everyone,


Randall Schulz
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups