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

Re: Help! File permissions keep changing...



On Wed, Feb 18, 2004 at 02:23:30PM +0100, Javier Fernández-Sanguino Peña wrote:
Hmmm.. I did say there was plenty of room for improvement, after all, obviously shell scripting is more prone to failure than a proper program in C but let's give it a shot:

You're barking up the wrong tree. You can't do this securely (i.e.,
without race conditions) without using a procedure similar to that
outlined by Rusell Coker. *Any* time you do a stat operation of some
sort to check permissions before doing something dangerous you are
starting a race. A malicious party will win the race eventually if you
give them enough opportunity (e.g., a cron job).

Mike Stone



Reply to: