Welcome to
The DFN Weekly

Safety in Numbers
- and Letters

By

Old Tom

OT Scripts

Okay, so you have a problem with your server. It happens. Can you find and fix that kind of problem all by yourself, without help? Yes? You know what you're doing. But, if you can consistently avoid that problem in the first place, you really know what you're doing.

Now, when I ask you if you really know what you're doing, you will know precisely what I'm asking.

Did you know that you can seriously screw up your unix/linux server by choosing bad file and folder names? One of our OT Scripts customers told me that he'd had a call from his server admin just this week. He had spaces in so many file and folder names - thousands of them - that the server was locked up tight. Even the server admin couldn't get to the files for half an hour or so.

Once he removed the spaces from the file and directory names, all was well. Sure, my software is designed to handle that, but that's not true of unix in general or the Apache server in particular.

You do things which seem perfectly normal - but they're deadly to your server, for one reason or another. So... what "normal" things should you avoid? That's what this article is about.

When choosing file and folder names, do not use spaces in the name. "Main page.htm" for example, is an extremely bad choice. Yes it will work, and you can handle it if you really know what you're doing. If you know all about url encoding and unix command line parsing, you already know how to make things work. But if you don't happen to be a server guru, please follow my advice!

Here is the advice: Use letters (a-zA-Z), numbers (0-9), the underscore (_), the hyphen (-), and the dot (.). Use nothing else in file names or folder names. Notice that the minus sign is safe, but the plus sign is not!

"Laugh and the world laughs with you.
Snore and you sleep alone."
Anthony Burgess
Have you checked out
the sponsors of the DFN Weekly yet?
Well what are you waiting for?
Check them out NOW!

Remember that the forward slash (/) is to unix/linux, what the backslash (\) is to dos/windows. Don't use either one in a file or folder name. The backslash has a very different meaning in unix/linux. It's the "escape" character. It tells the server to pass through the next character undisturbed. The point is, don't use slashes left, right, or center (/|\) unless you really know what you're doing.

To be sure, you can use any character at all, as part of a file or folder name. Any data at all can be encoded and passed as part of a web page or url. For example, the space character gets encoded as %20 if it's part of a url, and gets encoded as + if it's part of plain text. So, your site title would be encoded as "My+Awesome+Site" and the url would be "Main%20page.htm". Like I said, you need to really know what you're doing, to keep things straight.

Be particularly careful to not accidentally cut and paste an extra space at the beginning or end of something. I have run across a lot of files named something like index.htm%20 or domain.com/%20index.html. If you see a %20 show up, that's what happened.

I must admit that years ago, I included special characters (such as the backspace) as part of my unix file names. That way, when someone else tried to list out my directory contents, what they saw did not match what was actually there. In effect, I was cloaking my file names.

Did you know that many keyboards are programmable? Of course you knew that. It's possible - at least it was under unix at the time - for a program to send control sequences which set up the keyboard. Some of my file names contained those sequences. So, if someone was nosy enough to peek at my files, they got their function keys reprogrammed. Next time they used that key, I had a back door installed. (Who needs to download a virus when you can directly control the keyboard?)

In other words, unix/linux can surprise you unless you really know what you're doing. You'll save yourself a lot of time by playing it safe. Just remember there's safety in numbers - and letters - and very little else.

Old Tom

The DFN Weekly Staff
Jojasa ... Chief Editor - Wingnut ... Asst. Editor
Weekly Contributors
Voltar, Old Tom, LadyB, PastaBoy, Widearea
VNWR Staff
Voltar ... President - Old Tom ... Vice President
Jojasa ... Vice President - LadyB ... Vice President


©2002 VNWR. All rights reserved.