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 17:35:41 -0800
  • Message-id: <200901131735.42164.rschulz@xxxxxxxxx>
On Tuesday January 13 2009, Henare Degan wrote:
Hi list,

I want to change permissions on a large directory structure to only
RW for the owner of all the files. If I:

chmod -R 600 /path/of/directory

it won't work because it removes the 'x' bit from the directory,
which prevents traversal. The only solution I've come up with is to:

chmod -R 700 /path/to/directory

and then:

chmod 600 `find /path/to/directory -type f`

Which seems like a round-about way to achieve this (and needs some
hackery it you have messy file names, like ones with '-' in the
path), what's the "correct" way?

Look into the symbolic mode changing syntax, which includes incremental
notations for adding or removing permissions.

E.g.:

# Add execute permissions:
% chmod +x ...

# Remove write permissions:
% chmod -g ...

# Take away write permissions only from group and world (all):
% chmod ga-w ...

# Give owner write and read permissions:
% chmod o+rw ...


etc.


Cheers,

h


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

< Previous Next >
Follow Ups
References