Re: What syntax for global 'chown' fix?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Dale Farnsworth
Date:  
To: plug-discuss
CC: 
Subject: Re: What syntax for global 'chown' fix?
Joe wrote:
> While the example commands below work to change permission for either a
> complete system or for a complete directory and all sub-directories, what
> would the syntax be for a similar command to 'chown' (change the owner)
> globally or for a designated directory and and the files and
> subdirectories below it?
>
> find . -type f -print0 | xargs -0 chmod 644
> find . -type d -print0 | xargs -0 chmod 755
>
> find dir -type f -print0 | xargs -0 chmod 644
> find dir -type d -print0 | xargs -0 chmod 744


Joe, before answering your question, I feel the need to warn you.

If you understood what the above commands do, the answer would be obvious
and you wouldn't have asked the question. Further, IMHO, unless you know
what each part of the above commands do, you shouldn't use them. Each
line has three commands, each of which is readily understandable with
some effort.

(BTW, none of the above commands change permissions for a complete system.
They only do it recursively for files in a directory or for a directory
and its subdirectories.)


To change the owner and group for a directory and recursively to its
files and subdirectories, do:

(1)    chown -R owner:group dir


To change just the owner:

(2)    chown -R owner dir


To change just the group:

(3)    chown -R :group dir



An alternative way (just less efficient) to accomplish (1) is:

(4)    find dir -print0 | xargs -0 chown owner:group


-Dale
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss