Re: Bug in chown -- always kills suid/sgid bits.

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Thu, 5 Jun 1997 13:41:42 +0200


On Jun 5, Pavel Machek wrote:

> Have you ever had 100 files, 25 of them setuid, with right permissions
> but wrong owner? They were setuid 234 instead of setuid root. How do
> you change their permissions?

either write your own small `chown' tool preserving permissions
or use standard tools e.g.

find -maxdepth 1 -perm -4000 > /tmp/suid-files.$$
find -maxdepth 1 -perm -2000 > /tmp/sgid-files.$$
chown user.group *
chmod u+s `cat /tmp/suid-files.$$`
chmod g+s `cat /tmp/sgid-files.$$`
rm /tmp/s?id-files.$$

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^