[Top][All Lists]

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

Re: chown clears suid bit!

From: Bob Proulx
Subject: Re: chown clears suid bit!
Date: Thu, 13 Apr 2006 17:54:39 -0600
User-agent: Mutt/1.5.9i

Brian K. White wrote:
> Thats a great idea and I think I will incorporate it. Thanks.
> There are some cases where it'll be hard to do though. This script for 
> example does a couple sweeping chown -R / chmod -R at the top of a tree of 
> around 30,000 files.
> Replacing the -R with any kind of loop might make it take too long to run.
> There are some other large sweeping passes that are a little more selective 
> that are based on find |xargs

I am only doing the above 'ls case chmod' when I am working with
individual files.  To operate on an entire tree of files using find
and xargs is definitely the way to go.  I tend to do the following:

  find some/path ! -perm -a=r -print0 | xargs -r0 chmod a+r

That should be very fast and will also avoid changing anything that
does not need to be changed.  Find is definitely the better tool for
finding files across a directory hierarchy.  I probably should use it
for individual files too.

> I'll try it though, maybe it'll be fast as long as I avoid and screen 
> output and make a mychmod() function that does a "while read a b c d e f 
> ... do ... done", and I can pipe ls -lR into that so I only run ls once, 
> and the while loop gets both perms and filename in one shot and can simply 
> compare values with no need to execute any processes inside the loop 99% of 
> the time.

With all of the new users coming online I always worry about spaces
and other non-traditional characters in filenames.  The old time users
never do this.  But the new folks do and the filesystem supports it.
Using null terminated strings when possible avoids most trouble.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]