You Don’t Have Permission To Do That

Website security is critical, on that I’m sure we’d all agree.

But it can sure be a pain in the ass sometimes. Can I hear a “hell YEAH!”?

So what do you do when WordPress tells you, “You don’t have permission to do that“? Or when in some fashion you see a message that WordPress is “Unable to create directory – Is its parent directory writable by the server?

If you’re not geekily inclined, you call in a professional. Like me. Who’s supposed to know everything about WordPress.

So when I was hit with both of these today on my own blog, I did what any experienced professional troubleshooter does — look for the complicated causes first. I mean, this can’t be something easy, right?

The first error I hit was when trying to add a new category during a post. Little red box says, “You don’t have permission to do that”. Wonderful. Well, I know I do. At least I think I do. So in true spirit of a troubleshooting professional, I open a new tab and look into the options table of the database because this can’t be anything simple. Yeah, everything looks right. So what’s the problem? Do I need to reinstall? (I really didn’t consider that, but for some people at the first sign of trouble, that’s what they do)

Well, poo. I guess the next step is to close the browser, clear the cache, and try again.

Hit the ‘Save Draft’ button on the post, it saves and reloads. The error goes away. What the hell, I’ll try again.

No errors, category added.

Ajax really chaps my ass sometimes…

So I finish up the post, and decide I want to add a plugin or two and I’ll play with the new search/auto-install features. I’m not a fan of auto-install. But I’m willing to work with it, because my clients are going to and I’d better know what’s up with it.

I find a plugin I want through the search feature, hit the install buttons and everything works flawlessly. Surprised? Hell yeah! It worked!

I knew of a plugin I wanted to install that isn’t in the WordPress plugins repository. I had a zip file on my machine, so I thought I’d try the “upload zip file and install” functionality. Hit the button, locate the file, hit continue…

Ha! There it was! I knew it! I knew it wouldn’t work. Where I was supposed to be seeing the sucess messages I was instead presented with “Unable to create directory – Is its parent directory writable by the server?

This is an error that has to do with permissions on files, and folders. I KNOW those were set right, because I set up my own blogs. I know what I’m doing (tongue firmly planted in cheek here). So after going through all of the file permissions just do double-check (FYI, necessary file permission settings are here), I started looking for more simple solutions.

Mod_security. “That’s the trouble,” I thought (mod_security is an Apache web server module designed to help keep the rifraff off of your server). That module has been a pain in my butt ever since WordPress start using the Flash-based uploader. Same sort of problems. That has to be the cause.

Nope. I’d already fixed that.

I wish I could say that I figured it out on my own. I suppose I would’ve, eventually. But fortunately Mr. Google had the answer, in the form of this conversation on the WordPress support forums.

What it finally boiled down to was a file path on the Settings > Miscellaneous page was wrong. WordPress had divined and preloaded the supposedly correct path to my uploads folder. What should have been in the box is wp-content/uploads. What was actually there was the full server path to the uploads folder, prefixed with a slash. The slash is what was causing the problem. On its face it looked correct (*nix file paths are normally notated with a beginning slash), but in this case it wasn’t. Removing the slash cured the problem.

Moral of this rather long story? Look for the easy solutions first.