[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chmod + chown



w00t.  i was thinking find was more like the find.exe from dos/win32.

i am certainly glad it isnt :).  learn something new everyday.

i appreciate the response (and certainly wasnt aware of the nice -d and -f 
switches)

for my next trick i will figure out exactly what permissions to set for 
what.

i am working on my desktop/fileserver and toying with samba/ftp in trying to 
make it as easy to use as possible for other people.  i have 3 120 gig 
drives mapped to /mnt/hdc1 hde1 and hdf1 respectively.

i have some stuff i want to run by people, but i will save that for a new 
thread

Casey



>From: Robert Citek <rwcitek@alum.calberkeley.org>
>On Monday, March 29, 2004, at 02:03  PM, john doe wrote:
>>is there any way to do a recursive chmod where it only modifies the file 
>>if it has a certain owner and group? i dont want to have to resort to 
>>shell scripting if i dont have to
>
>In the simplest case, find traverses a filesystem tree and prints all the 
>"files" (files, directories, devices, fifos, etc.)  For example:
>
>   $ find
>
>You can also specify a folder or list of folders.  For example, to traverse 
>both /etc, /var, and the current directory:
>
>   $ find /etc /var .
>
>You can also specify a test condition.  That is, if a "file" passes a test, 
>it will get listed.  For example, to find only regular files (not 
>directories nor devices nor fifos) in the directory tree rooted in the 
>current folder:
>
>   $ find . -type f
>
>You can also specify a series of test conditions.  Those tests will be 
>AND'ed by default.  For example, you want to find all files that are owned 
>by me:
>
>   $ find . -type f -user rwcitek
>
>Lastly, since the output is a list of files, you can pipe it to other 
>programs.  For example, to change the permissions to 0700 on all files 
>owned by me:
>
>   $ find . -type f -user rwcitek | xargs chmod 0700
>
>Find comes with a whole bunch of other goodies, including operators, 
>options, tests, and actions.  You can even do grouping.  For a brief 
>listing type 'find --help'  For a more detailed description of options, see 
>'man find'
>
>>i can with chown, which rocks, but i would like to be able to do it with 
>>chmod.
>>
>>also is there an easy way to do something like chmod 754 for directories 
>>but 755 for files? (not necessarily those 2 sets of permissions, but one 
>>set of permission bits for folders and another for files. that is more 
>>what i am after
>
>Yes.  This is exactly what find is for:
>
>   $ find . -type d -print0 | xargs -0 chmod 0754
>   $ find . -type f -print0 | xargs -0 chmod 0755
>
>The -print0 option in find and the -0 option in xargs properly handles 
>filenames that have spaces in them.
>
>Let us know what you decided to do and how things worked out for you.
>
>Regards,
>- Robert
>
>
>-
>To unsubscribe, send email to majordomo@silug.org with
>"unsubscribe silug-discuss" in the body.

_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.com/go/onm00200413ave/direct/01/


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.