FTP error in ClassicPress

Fixing “Unable to Create Directory” and FTP Prompt Issues in ClassicPress on Caddy Server

When I first installed ClassicPress on a freshly configured Caddy web server, everything seemed to go smoothly — until the first time I tried to upload an image.

The familiar red banner appeared with the error:

wordpress permissions : 
Unable to create directory wp-content/uploads/2025/11. 
Is its parent directory writable by the server?

At first glance, it looked like a minor permissions glitch, but it turned out to be the start of a deeper configuration issue involving how Caddy handles file ownership and how ClassicPress writes to disk. This article walks through exactly what caused the problem, how to fix it safely, and how to prevent the related FTP credential prompt that often follows. We’ll also cover how to remove index.php from your site’s URLs to complete a clean setup.

ClassicPress Caddy File Permission Error
Typical upload error on ClassicPress with incorrect file permissions

Understanding the Root Cause

When ClassicPress (or WordPress) reports it cannot create a directory under wp-content/uploads, it’s usually because the web server process doesn’t have permission to write there. In this case, the files were owned by the user amar — the one who installed ClassicPress — while Caddy runs as its own system user caddy. Because Linux enforces strict file ownership rules, the Caddy process simply didn’t have permission to create subdirectories like /wp-content/uploads/2025/11.

If you’re coming from Apache or Nginx, this can be confusing because those servers typically run under www-data or apache, and many hosting setups preconfigure permissions automatically. With Caddy, everything starts cleaner — and stricter — so you’ll need to adjust permissions manually after installation.

Linux permissions diagram
Ownership mismatch between Caddy and local user

Fixing Directory Permissions and Ownership

Step 1: Add Caddy to Your User Group

Adding the caddy user to your local user’s group (in this case, amar) lets the web server and your user account share access to the project folders. Run the following commands:

sudo usermod -aG amar caddy
sudo systemctl restart caddy

Restarting Caddy ensures the new group membership takes effect immediately.

Caddy user permissions command
Granting group access to the Caddy user

Step 2: Adjust Upload Directory Permissions

Next, give the uploads directory group write access so both amar and caddy can manage files:

sudo chmod -R 775 /var/www/classicpress/wp-content/uploads

The permission 775 allows the owner and group to read, write, and execute, while keeping everyone else read-only — a good balance of security and flexibility.

Fixing the FTP Prompt When Installing Themes

After fixing the upload issue, the next problem appeared when installing a theme — ClassicPress unexpectedly asked for FTP credentials:

Installing theme from uploaded file: mcluhanNov25.zip
Connection Information
To perform the requested action, ClassicPress needs to access your web server.
Please enter your FTP credentials to proceed.

This prompt appears because ClassicPress doesn’t realise it can write directly to your filesystem. By default, it assumes you’ll upload via FTP unless configured otherwise. Let’s fix that.

Step 3: Enable Direct File Access

Edit your wp-config.php (or wp1-config.php) and add this line just before the line that says:
/* That’s all, stop editing! Happy publishing. */

define('FS_METHOD', 'direct');

This single directive tells ClassicPress to perform direct writes to disk through PHP, bypassing the need for FTP credentials entirely.

ClassicPress wp-config direct method
Enable direct filesystem writes by updating wp-config.php

Removing index.php from URLs

With permissions fixed and FTP bypassed, the next refinement was cleaning up URLs. ClassicPress sites running on Caddy sometimes display index.php in the path — for example, example.com/index.php/about instead of example.com/about.

Step 4: Update Your Caddyfile

Open your site’s Caddyfile (commonly at /etc/caddy/Caddyfile) and ensure it includes a rewrite rule that redirects all non-static requests to index.php internally:

example.com {
    root * /var/www/classicpress
    php_fastcgi unix//run/php/php8.2-fpm.sock
    file_server

    @wordpress {
        path_regexp wp ^/(wp-admin|wp-login|wp-cron|wp-content|wp-includes|wp-json)
    }
    @notStatic {
        file {
            try_files {path} /index.php?{query}
        }
    }

    rewrite @notStatic /index.php?{query}
}

Then reload Caddy to apply the changes:

sudo systemctl reload caddy

Your ClassicPress URLs will now be clean, SEO-friendly, and free of index.php.

Caddy rewrite rules for WordPress
Proper rewrite rules in Caddyfile to remove index.php

Summary of Steps

Step Command / Action
Add Caddy to group sudo usermod -aG amar caddy
Restart Caddy sudo systemctl restart caddy
Set upload folder permissions sudo chmod -R 775 wp-content/uploads
Enable direct file writes define('FS_METHOD', 'direct');
Remove index.php from URLs Add rewrite @notStatic /index.php?{query} in Caddyfile

Final Thoughts

Caddy is a fantastic choice for hosting ClassicPress or WordPress — lightweight, secure, and automatically HTTPS-enabled. But because it runs as its own user, file ownership issues are almost inevitable on first install. By giving Caddy group access to your project, setting sensible permissions, and defining FS_METHOD, you solve both the upload error and the FTP prompt in one go. Adding the rewrite rule completes the setup, removing index.php and ensuring your URLs are clean and professional.


Also Read: Setting up PHP-FPM pools for multi-site WordPress on Caddy
FAQ

1. Why does ClassicPress ask for FTP credentials?
Because it doesn’t detect writable permissions via PHP. Adding define('FS_METHOD', 'direct'); fixes that.

2. Is it safe to give Caddy write access?
Yes, as long as only the wp-content folder is writable. Keep wp-admin and wp-includes read-only.

3. Do I need to reload PHP-FPM after changing permissions?
Usually not, but it’s a good idea if you’ve adjusted user groups or ownership.

Have you faced this issue on your first Caddy install? Share your experience in the comments — your fix might save someone else’s weekend!


This post titled “Fixing ‘Unable to Create Directory’ and FTP Prompt Issues in ClassicPress on Caddy Server” was published under category “Server Administration” and last updated November 12, 2025.