Skip to content

Drupal Users, Security & Administration — Enterprise CMS Guide

DodaTech Updated Jun 6, 2026 7 min read

Drupal’s user system is far more granular than any other major CMS. Instead of WordPress’s predefined roles (Administrator, Editor, Author), Drupal gives you empty roles where you explicitly grant each permission. Think of it like building a security system: you decide exactly which doors each person can open, rather than giving them a single “employee” badge that opens everything.

What You’ll Learn

  • Drupal’s role-based access control (RBAC) with granular permissions
  • Creating custom roles and assigning permissions
  • Security hardening — file permissions, updates, .htaccess rules
  • URL aliases with Pathauto for clean URLs
  • Multilingual content configuration
  • Backups and performance optimization

Why Granular Permissions Matter

In WordPress, an “Editor” can edit any content — including articles, pages, and custom post types. But what if you need someone who can only edit press releases but not financial reports? In Drupal, you create a “Press Editor” role and grant exactly those permissions.

This is critical for enterprise sites where different teams manage different content types. DodaTech’s content infrastructure uses similar role-based workflows. Even Durga Antivirus Pro uses permission-based access for its documentation portal.

    flowchart LR
    A["Themes, Layouts & Extensions"] --> B["Users, Security & Administration<br/><strong>You are here</strong>"]:::current
    B --> C["Drupal Developer Reference"]

    classDef current fill:#38bdf8,color:#0f172a,stroke-width:2px;
  
Prerequisites: Drupal 10 installed with Standard profile. You should be familiar with content types and modules. Admin access required for permission changes.

User Roles and Permissions

Default Roles

RoleDescription
AnonymousUnauthenticated visitors — can view published content
AuthenticatedLogged-in users — base role with minimal permissions
AdministratorSuper admin — has ALL permissions automatically

Creating Custom Roles

  1. People → Roles → Add role
  2. Name the role (e.g., “Editor”, “Contributor”, “Publisher”)
  3. Click Edit permissions for the new role
  4. Check the exact permissions needed:
Content permissions (per content type):
  □ Create new content (Article, Basic Page, Case Study...)
  □ Edit own content
  □ Edit any content
  □ Delete own content
  □ Delete any content
  □ View unpublished content
  □ Use advanced publishing options (promote, sticky)

Comment permissions:
  □ Post comments
  □ Edit own comments
  □ Administer comments

System permissions:
  □ Access administration pages
  □ Administer modules     ← WARNING: effectively gives full site access
  □ Administer site configuration
Unlike WordPress which has 6 predefined roles, Drupal roles are empty by default. You explicitly grant every permission. This is powerful but requires careful planning — a common mistake is granting “Administer modules” when only “View unpublished content” was needed.

Programmatic User Management

<?php
// Create a user programmatically
$user = \Drupal\user\Entity\User::create();
$user->setUsername('newuser');
$user->setEmail('newuser@example.com');
$user->setPassword('securepassword');
$user->addRole('editor');
$user->activate();
$user->save();

// Update a user's roles
$user = \Drupal\user\Entity\User::load(5);
$user->addRole('content_approver');
$user->removeRole('editor');
$user->save();
?>

Security Hardening

1. Keep Drupal Updated

# Check for outdated packages
composer outdated

# Update Drupal core
composer update drupal/core --with-dependencies

# Apply security patches
composer update drupal/core-recommended --with-all-dependencies

2. File System Permissions

# Secure permissions for production
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 444 sites/default/settings.php
chmod 555 sites/default
chmod 777 sites/default/files  # Writable for uploads only

3. .htaccess Hardening

Drupal’s default .htaccess is good, but add these for extra protection:

# Block access to sensitive files
<FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|composer\.(json|lock)|\.gitignore)$">
  Require all denied
</FilesMatch>

# Block PHP execution in uploads directory
<Directory "/sites/default/files">
  <FilesMatch "\.php$">
    Require all denied
  </FilesMatch>
</Directory>

Security Modules

ModulePurpose
Security KitSecurity headers, CORS, anti-CSRF
CAPTCHABot protection
HoneypotAnti-spam without user interaction
Login SecurityBrute force protection
Password PolicyEnforce password complexity
Two-factor Authentication (TFA)2FA support

URL Aliases

Drupal uses internal numeric paths (/node/123). The Path module (core) and Pathauto (contributed) create clean URLs.

Manual Aliases

When editing content, expand the URL alias section and enter an alias (e.g., about-us/history).

Automatic Aliases with Pathauto

composer require drupal/pathauto drupal/token

Configure patterns at Configuration → Search and metadata → URL aliases → Patterns:

Content TypePatternExample URL
Articlecontent/article/[node:title]/my-article-title
Basic Page[node:menu-link:parent:url]/[node:title]/about/team
Taxonomy Term/[term:vocabulary]/[term:name]/topics/technology

Multilingual Content

Drupal has the best multilingual support among major CMS platforms — everything is built-in.

Enabling Multilingual

  1. Extend → Enable: Language, Content Translation, Configuration Translation
  2. Configuration → Regional and language → Languages → Add languages
  3. Configuration → Regional and language → Content language → Enable translation per content type

Language Detection Methods

Configure at Configuration → Regional and language → Language detection:

  1. URL prefix (/fr/about — most common)
  2. Domain (fr.example.com)
  3. Browser language detection (auto-detect)
  4. Session parameter
  5. User profile setting

Backup & Performance

Backup

# Backup database
drush sql:dump --result-file=../backups/drupal-backup-$(date +%Y%m%d).sql

# Backup files
tar -czf ../backups/files-$(date +%Y%m%d).tar.gz sites/default/files/

# Export configuration
drush config:export --destination=../backups/config-export

Performance Optimization

  1. Enable caching — Configuration → Development → Performance:

    • Page cache (anonymous users)
    • Dynamic page cache (authenticated users)
    • Bandwidth optimization (CSS/JS aggregation)
  2. Install Redis:

composer require drupal/redis

In settings.php:

$settings['redis.connection']['host'] = 'localhost';
$settings['redis.connection']['port'] = 6379;
$settings['cache']['default'] = 'cache.backend.redis';

Common Mistakes

1. Leaving the Administrator Account as “admin”

The super-admin username is the first thing attackers try. Create a separate admin account with a unique username and disable the original “admin” user.

2. Granting “Administer Modules” to Editors

This permission allows installing and uninstalling any module — effectively full site access. Never give it to non-technical roles.

3. Not Running Cron

Drupal cron handles index maintenance, cleanup, and module housekeeping. Set up cron every 3 hours:

echo "0 */3 * * * /usr/bin/drush -r /var/www/drupal cron" | crontab -

4. Storing Configuration Only in the Database

Configuration in the database can’t be version-controlled or easily deployed. Always export to YAML:

drush config:export   # Export to YAML files
drush config:import   # Import from YAML files

5. Not Using Redis or Varnish

Without a caching layer, every page load runs dozens of PHP processes and SQL queries. Redis (for cache) and Varnish (for full page cache) are essential for production Drupal.

Practice Questions

  1. How is a Drupal role different from a WordPress role?
    Answer: WordPress roles have predefined capabilities. Drupal roles are empty — you explicitly define every permission from hundreds of granular options.

  2. What is the safest way to apply security updates to Drupal?
    Answer: Take a full backup, update with composer update drupal/core --with-dependencies, run drush updatedb, then drush cache:rebuild. Test on a staging site first.

  3. How do you reset the admin password without email access?
    Answer: Use Drush: drush user:password admin newpassword. Or use the password hash script in core/scripts/password-hash.sh.

  4. Challenge: Set up a content moderation workflow with two custom roles — “Author” (create/edit own content) and “Publisher” (approve/publish any content). Enable the Content Moderation module and configure a Draft → Review → Published workflow. Create a user for each role and verify the workflow works.

FAQ

How do I configure HTTPS in Drupal?
: Set $settings['trusted_host_patterns'] = ['^example\\.com$']; and $base_url = 'https://www.example.com'; in settings.php. Configure your web server to redirect HTTP to HTTPS.
Can I have different languages on different domains?
: Yes. Use the Language module’s domain-based detection. Each language uses a different domain (e.g., example.com for English, example.fr for French) serving the same Drupal installation.
What is the safest way to perform a Drupal backup?
: 1) Export config: drush cex. 2) Dump database: drush sql:dump. 3) Archive files: tar -czf files.tar.gz sites/default/files/. Store all three off-site.
How often should I clear Drupal’s cache?
: Don’t clear cache manually on production — it slows the site temporarily. Cache clears automatically during cron runs and module updates. Use drush cr only after configuration or code changes.
Can I use Drupal for a headless CMS?
: Yes. Drupal’s REST API and JSON:API modules (both core) expose content as JSON. Front-end frameworks like React, Vue, or Next.js consume the API for decoupled architectures.

Try It Yourself

  1. Create an “Editor” role with permissions: create/edit/delete own articles, view unpublished content
  2. Create a user with that role and log in as them
  3. Set up Pathauto with a pattern: articles/[node:title] for Articles
  4. Enable cron via crontab to run every 3 hours
  5. Export configuration to YAML with drush cex

What’s Next

TopicDescription
Drupal Developer ReferenceHooks, entities, render arrays, Drush commands cheatsheet
PHPCustom module and hook development
MySQLDrupal database structure and optimization
WordPressCompare Drupal’s approach to WordPress
JoomlaCompare Drupal’s approach to Joomla

What’s Next

Congratulations on completing this Drupal Users Security Administration tutorial! Here’s where to go from here:

  • Practice daily — Consistency is more important than long study sessions
  • Build a project — Apply what you learned by building something real
  • Explore related topics — Check out other tutorials in the same category
  • Join the community — Discuss with other learners and share your progress

Remember: every expert was once a beginner. Keep coding!

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro