Re:Unix Admin Horror Story Summary (1992)
by geocrasher on Tuesday December 21, 2021 @05:15PM
(#29642772)
This one made me LOL:
I read this, and just had to go try it because I couldn't picture it in my brain. Here it is:
So if you're in /tmp/ and do 'rm -rf ./.*', it's
and ./.. is .. which from tmp is /. Thankfully we have protections against this now. Back then, not so much.
[ Parent
| on HN ]
Re:Unix Admin Horror Story Summary (1992)
by simonblack on Tuesday December 21, 2021 @07:27PM
(#29643939)
As a brand-new UNIX user around 1991 and coming from MSDOS, I was used to being 'God' on my machine so I thought it would be a good idea to login always as 'root'. I couldn't understand why long-time users of UNIX knew that to be a very bad idea, and always advised against it.
Like the SunOS person, I had lots of dot-directories in /tmp. So I duplicated his actions almost perfectly.
Also like he did, I was wondering why an 'instantaneous' action was taking so long. I had to do a complete re-installation.
Ever since then, I've always logged in as a 'normal user'. My reign as 'God' in a UNIX environment lasted about 2-3 weeks in total.
Re:Unix Admin Horror Story Summary (1992)
by yjftsjthsd-h on Tuesday December 21, 2021 @06:21PM
(#29643345)
Huh, what do you know. I thought modern rm only protected against deleting / by absolute path, but it looks like it'll protect you from deleting your parent regardless:
$ docker run --rm -ti debian:11 # sandbox the danger...
root@c70dde9f38a3:/# cd /tmp
root@c70dde9f38a3:/tmp# rm -rf ./.
rm: refusing to remove '.' or '..' directory: skipping './.'
root@c70dde9f38a3:/tmp# mkdir -p /tmp/1/2/3/4/5
root@c70dde9f38a3:/tmp# cd /tmp/1/2/3/4/5
root@c70dde9f38a3:/tmp/1/2/3/4/5# rm -rf ./.
rm: refusing to remove '.' or '..' directory: skipping './.'