From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcda7,d4c1f7c0fe672a4 X-Google-Attributes: gidfcda7,public X-Google-Thread: 10872d,d4c1f7c0fe672a4 X-Google-Attributes: gid10872d,public X-Google-Thread: 1020c6,d4c1f7c0fe672a4 X-Google-Attributes: gid1020c6,public X-Google-Thread: 1164f8,d4c1f7c0fe672a4 X-Google-Attributes: gid1164f8,public X-Google-Thread: 1070f0,d4c1f7c0fe672a4 X-Google-Attributes: gid1070f0,public X-Google-Thread: 111731,d4c1f7c0fe672a4 X-Google-Attributes: gid111731,public From: janfrode@kunst.uib.no (Jan-Frode Myklebust) Subject: find /tmp and remove Re: Different UNIX pro's and con's. Date: 1998/09/18 Message-ID: #1/1 X-Deja-AN: 392378228 References: <35F71814.1E0B911C@iakom.com> <35FB108D.F8FEFEBE@home.com> <6ti5t2$lbr$1@Venus.mcs.net> <35FDE10D.3380C3C1@home.com> <6tkqni$m41@web.nmti.com> <36019311.0@news.thefree.net> <6tsafu$4cr$1@camco.celestial.com> <36023111.4C0B@lmt.ens-cachan.fr> Organization: University of Bergen, Norway Newsgroups: comp.unix.advocacy,comp.unix.admin,comp.sys.hp.hpux,comp.sys.sgi.admin,comp.sys.sun.admin,comp.sys.dec On Fri, 18 Sep 1998 12:08:17 +0200, Sanchez Philippe wrote: >Jan-Frode Myklebust wrote: >> >> >> Only problem is that it make is possible for any user to delete any file >> on your system. >> >> mkdir /tmp/foo/bar/ >> touch /tmp/foo/bar/passwd >> >> In the time between when 'find /tmp -type f -atime +7 -exec rm {} \;' >> finds /tmp/foo/bar/passwd, and 'rm' removes /tmp/foo/bar/passwd >> you do (very fast here:) >> >> mv /tmp/foo/bar/bar /tmp/foo/foo >> ln -s /etc /tmp/foo/bar >> >> Then 'rm' comes along and removes your /etc/passwd. >> >> -- >> -janfrode > >find(1) > [Snip] > below. By default, find does not follow symbolic links. > But there where no symbolic links for 'find' in my example. 'find' finds the file /tmp/foo/bar/passwd which is a normal file, but before 'rm' comes along you: mv /tmp/foo/bar/bar /tmp/foo/foo ln -s /etc /tmp/foo/bar What happens now when 'rm' tries to remove /tmp/foo/bar/passwd? -janfrode