Server Maintenance

ModSecurity: collection_store: Failed to access DBM file /var/cpanel/secdatadir/ip: Permission denied

Updated November 2026 21,956 views 3 min read
Server Maintenance | Updated November 2026

The error collection_store: Failed to access DBM file /var/cpanel/secdatadir/ip: Permission denied appears in Apache error logs when ModSecurity cannot write to its persistent data store. This causes ModSecurity rules that track IP-based counters (rate limiting, brute force detection) to fail silently.

01. Root Cause

ModSecurity stores persistent collections (IP tracking, session data, rate limiting counters) in DBM files under /var/cpanel/secdatadir/. Apache runs as the nobody user and needs write access to this directory.

The permissions get corrupted when:

  • A server migration or restore changes ownership to root
  • A cPanel update resets permissions
  • An admin manually changes ownership while troubleshooting
  • The DBM files become corrupted after an unclean shutdown

02. Fix: Reset Permissions

  1. Fix ownership - Apache (nobody) must own the directory and files:
    chown -R nobody:nobody /var/cpanel/secdatadir/
  2. Fix directory permissions:
    chmod 700 /var/cpanel/secdatadir/
  3. Remove corrupted DBM files - they will be recreated automatically:
    rm -f /var/cpanel/secdatadir/ip.*
    rm -f /var/cpanel/secdatadir/global.*
  4. Restart Apache:
    systemctl restart httpd
Do Not Delete the Directory

Only remove the .dir and .pag files inside the directory. Do not delete /var/cpanel/secdatadir/ itself. ModSecurity will not recreate the directory automatically - only the files within it.

03. Verify the Fix

# Check for new errors
tail -f /usr/local/apache/logs/error_log | grep collection_store

# Verify permissions
ls -la /var/cpanel/secdatadir/
# Should show: drwx------ nobody nobody

# Check DBM files are being created
ls -la /var/cpanel/secdatadir/ip.*
# Should show new files owned by nobody

04. Preventing Recurrence

  • After server migrations, check that /var/cpanel/secdatadir/ is owned by nobody
  • If using OWASP CRS, verify SecDataDir in your modsec config points to the correct path
  • Monitor error logs - add this to your log monitoring:
    grep "collection_store" /usr/local/apache/logs/error_log
ModSecurity Data Directory Location

The default path on cPanel servers is /var/cpanel/secdatadir/. This is set by the SecDataDir directive, typically in /etc/apache2/conf.d/modsec/modsec2.cpanel.conf. If your server uses a custom path, substitute accordingly.

Need Help With ModSecurity?

If ModSecurity errors persist or you need help configuring rules, contact our team.

Open a Support Ticket

Frequently Asked Questions

What does the ModSecurity collection_store DBM Permission denied error mean?

It means ModSecurity cannot write to its persistent data store at /var/cpanel/secdatadir. ModSecurity rules that track per-IP counters, such as rate limiting and brute-force detection, rely on that store, so when it cannot be written those rules fail silently while the error fills your Apache logs.

How do I fix the secdatadir Permission denied error?

As root, reset the ownership and permissions on /var/cpanel/secdatadir so ModSecurity can write to it, then verify the error stops appearing in the Apache error log. On cPanel the directory should be writable by the user that runs ModSecurity.

Is the collection_store error dangerous?

It does not take your site down, but it weakens security because the IP-tracking rules cannot store their counters, so rate limiting and brute-force protection stop working. It also floods the Apache error log. Fixing the permissions restores the protection and clears the log noise.

Do I need root to fix the secdatadir error?

Yes. The fix changes permissions on a system directory under /var/cpanel, which requires root, so it applies to VPS and dedicated servers. On shared hosting the server administrator handles it; open a ticket if you see this error on a shared account.

Quick Recap

  1. chown /var/cpanel/secdatadir/ to nobody:nobody
  2. chmod 700 on the directory
  3. Remove corrupted ip.* and global.* DBM files
  4. Restart Apache
  5. Verify no new errors in error_log

20,888 users found this article useful · Last updated November 2026 · Browse all Server Maintenance articles

Share: X in Reddit f Email
  • 145 Users Found This Useful

Was this answer helpful?

Related Articles

PHP Startup: Unable to Load Dynamic Library

Server Maintenance | Updated March 2026 "PHP Startup: Unable to load dynamic library" errors...

FTP Failed: Service Check Unable to Connect to Port 21

Server Maintenance | Updated March 2026 When cPanel's service monitoring reports "FTP Failed:...

Failed to start tailwatchd - Unit tailwatchd service entered failed state

Server Maintenance | Updated January 2026 The error Failed to start tailwatchd - Unit...

Failed to lock proc mutex: Permission denied

Server Maintenance | Updated November 2026 The error "failed to lock proc mutex: Permission...



Save 30% on web hosting - Use coupon code Hosting30