Re: chmod, chgrp and symlinks

From: Ramazan Jah-Far (ramazanjf@svitonline.com)
Date: 02/04/03


From: Ramazan Jah-Far <ramazanjf@svitonline.com>
Date: Wed, 5 Feb 2003 00:02:23 +0200

Hi!
In comp.os.linux.security, Kasper Dupont wrote:
 KD> Nico Kadel-Garcia wrote:
>> You've *completely* ignored hard links.

Yes. I don't know what to do with them.

 KD> In that case you could refuse to change permissions on any
 KD> file with multiple links. Use the find command and the
 KD> "-links 1" test.

Hardlinks are a pain in ass anyway. Considering all
said above, hardlinks turn to be a sort of design
flaw. IMO.

Think what will happen when someone make hardlink of
every file in $dir:
 KD> and to prevent chmod on hardlinks you could use:
 KD> find $dir -type f -links 1 -name '*.mp3' -print0 | xargs -0 chmod 640
This will _prevent_ the very sense of the script :),
i.e. will cause DoS.

--
Bye!
Ramazan

Quantcast