On Sun, Mar 22, 1998 at 06:27:57PM +0200, [EMAIL PROTECTED] wrote:
> What is an example of a script that does this :
> searches /root/ for instance and if it finds a directory does 'chmod 700'
> on that directory and if it finds a file does 'chmod 600' on that file.
>
> I tryed to use 'find -exec', but how do i make chmod to take as an
> argument the file name that 'find' finds ?
Of the top of my head (you might want to remove the worst syntax errors
using the find man page):
find /root \( -type d -exec chmod 700 {} \; \) -o \
\( -type f -exec chmod 600 {} \; \)
Or, alternatively:
find /root -type d -print0 | xargs -0 chmod 700
find /root -type f -print0 | xargs -0 chmod 600
I'm not sure which one is faster.
I hope there are no executables in /root, otherwise they won't be executable
any more after this runs. you might want to consider replacing the 700 and
600 with go-rwx, which removes all permisions for "group" and "world" but
leaves owner permissions intact. Thus exectuables will remain executable :)
Hope this helps...
Groetjes,
Kees-Jan
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.