When is a directory not a directory?

I love it. Just when I start getting a little bored…, something comes along that basically makes me go, “WTF?” – and ends up giving me a chuckle in the end. There’s stuff that’s broken, and then there’s stuff that’s REALLY broken….

Very recently, we’ve been tasked with helping migrate key components of an old server that belonged to another department. We’re going to migrate the important stuff to a new server of ours,and retire the rest. A lot of this has been my task, but it also involves our DBA and a handful of developers taking a little time on the side to hunt and migrate.

This morning, a developer emailed me about an issue he was having with tar – and could I tar stuff up for him? While a pretty basic problem, I figured ok, sure, whatever.

And I got an error.

The directory in question is buried deep in a TOMCAT installation. And the error? It referred to a subdirectory “~fred”.

Um, wait. “~” ?

Sure enough- I checked, and there it was – a subdirectory named “~fred”. I fired up my web browser, and checked out the contents of this thing we were dealing with: (http://node.domain:8080/~fred ) – wow- an actual jsp web page. Then I looked in the directory (note: to look IN the directory, I had to quote it…)– and there was no jsp file in there.

WTF?

It turns out that yes, there was an actual subdirectory named “~fred”. It *also* turns out that fred *did* have a user account on this box, and he DID have a home directory. Elsewhere. That has totally different content and ownership.

By now most of you are muttering to yourselves, “wow- that’s just SO broken of a setup”. And, I would agree. But a FEW of you are also going “whoa… that could be a really freaky way to hide the actual contents of a directory!”. And you’re going to stop reading my blog right now to go play. Pretty cool, huh? It’s weird, stupid, broken. But yeah, kinda cool.

Why was it set up this way? Who knows– the people responsible for this abomination are long gone, I can only conjecture that this guy’s home directory once was available at http://node.domain/~fred But, when they converted to tomcat, they couldn’t get the home directory thing to work anymore, and instead copied the web content into the tomcat environment. By naming the subdirectory with a leading tilde, the actual URL was able to remain exactly the same as it had been published, and it would all still work.

“Things that make you go: Ewwwwwwwwww. Welcome to being a sysadmin.”