Single Sign-On (SSO) is one of the most powerful security upgrades you can add to your homelab. Instead of managing separate logins for every service — Nextcloud, Jellyfin, Grafana, etc. — you authenticate once and access everything. Two solutions dominate the self-hosted SSO space: Authelia and Authentik.
In this guide, we’ll compare both, walk through complete setup steps for each, and help you choose the right one for your needs.
What Is Single Sign-On (SSO)?
SSO lets you log in once to access multiple services without re-entering credentials. It centralizes authentication, making it easier to enforce security policies like two-factor authentication (2FA) across your entire homelab.
Benefits:
- One login for all services
- Centralized 2FA (TOTP, WebAuthn, hardware keys)
- Access control — block unauthorized users at the gateway
- Audit logs — track who accessed what and when
- Better security — enforce strong auth policies in one place
Authelia vs Authentik — Key Differences
Both are open-source, Docker-ready SSO solutions, but they target different use cases.
Authelia
Best for: Simple, lightweight SSO in front of existing services.
Strengths:
- Minimal resource footprint (~50 MB RAM)
- Simple YAML configuration
- Works seamlessly with Traefik, Caddy, nginx
- Built-in 2FA (TOTP, WebAuthn, Duo)
- LDAP integration for user management
- Easy to understand access control rules
Weaknesses:
- No web UI for configuration (YAML only)
- No built-in user registration
- Relies on external user database (LDAP, file-based, etc.)
Authentik
Best for: Feature-rich identity provider with full user management.
Strengths:
- Beautiful web UI for configuration
- Built-in user management (no LDAP required)
- OAuth2, SAML, LDAP provider
- Custom branding and theming
- User self-registration and invites
- Advanced policies and flows (like Azure AD)
Weaknesses:
- Higher resource usage (~300-500 MB RAM)
- Steeper learning curve
- More complex initial setup
Quick decision:
- Use Authelia if you want lightweight SSO with Traefik/Caddy and already have LDAP.
- Use Authentik if you need a full identity platform with user management and OAuth2 support.
Setting Up Authelia
Prerequisites
- Docker and Docker Compose installed
- A reverse proxy (Traefik, Caddy, or nginx Proxy Manager)
- A domain with wildcard DNS or individual A records for each service
- Redis (for session storage)
Step 1: Create Docker Compose File
Create a directory for Authelia:
| |
Create docker-compose.yml:
| |
Step 2: Configure Authelia
Create config/configuration.yml:
| |
Replace yourdomain.com with your actual domain.
Step 3: Create Users
Create config/users_database.yml:
| |
Generate a password hash:
| |
Replace HASH_HERE with the output.
Step 4: Start Authelia
| |
Check logs:
| |
Step 5: Configure Reverse Proxy (Traefik Example)
Add middleware to your Traefik config:
| |
Apply it to a service:
| |
Step 6: Access and Setup 2FA
- Visit
https://auth.yourdomain.com - Log in with your username/password
- Scan the TOTP QR code with your authenticator app (Authy, Google Authenticator, etc.)
- Enter the 6-digit code
Now any service behind Authelia requires login + 2FA.
Setting Up Authentik
Prerequisites
Same as Authelia, plus:
- PostgreSQL (Authentik requires it)
- More RAM (~500 MB minimum)
Step 1: Create Docker Compose File
Create directory:
| |
Download the official Authentik docker-compose.yml:
| |
Or create manually:
| |
Step 2: Generate Secrets
Create .env file:
| |
Step 3: Start Authentik
| |
Check logs:
| |
Step 4: Initial Setup
- Visit
http://your-server-ip:9000/if/flow/initial-setup/ - Create your admin account
- Log in
Step 5: Create an Application (Example: Nextcloud)
- Go to Applications → Create
- Name: Nextcloud
- Slug: nextcloud
- Provider: Create a new Proxy Provider
- Type: Forward auth (single application)
- External host:
https://nextcloud.yourdomain.com
- Save
Step 6: Configure Reverse Proxy (Traefik Example)
Add Authentik middleware:
| |
Apply it:
| |
Step 7: Setup 2FA
- Go to User Settings → MFA Devices
- Click Enroll → TOTP
- Scan QR code with your authenticator app
- Enter the code
You can also enable WebAuthn (hardware keys like YubiKey).
Authelia vs Authentik — Feature Comparison
| Feature | Authelia | Authentik |
|---|---|---|
| Resource usage | ~50 MB RAM | ~300-500 MB RAM |
| Configuration | YAML files | Web UI |
| User management | External (LDAP/file) | Built-in |
| 2FA support | TOTP, WebAuthn, Duo | TOTP, WebAuthn, SMS, Email |
| OAuth2 provider | ❌ | ✅ |
| SAML provider | ❌ | ✅ |
| LDAP provider | ❌ | ✅ |
| Self-registration | ❌ | ✅ |
| Custom branding | Limited | Full theming |
| Learning curve | Easy | Moderate |
| Best for | Lightweight SSO | Full identity platform |
Advanced Tips
Use LDAP for Centralized Users
Both Authelia and Authentik support LDAP. You can run your own with lldap or OpenLDAP and sync users across all services.
Example lldap Docker Compose:
| |
Connect Authelia or Authentik to lldap instead of using file-based users.
Hardware Security Keys (WebAuthn)
Both support YubiKey, Titan, or any FIDO2 key. This is the gold standard for 2FA.
Enable in Authelia:
| |
Enable in Authentik via the web UI under Flows.
Email Notifications
For production use, configure SMTP in either solution to send password reset emails and notifications.
Authelia example:
| |
Authentik: Configure under System → Tenants → Default Tenant → Email.
Troubleshooting
Authelia: “Access denied”
Check access_control rules in configuration.yml. Make sure the domain matches and the policy allows access.
Authentik: “Unauthenticated”
Check that the forward auth middleware is correctly configured and the external host URL matches your service.
Session timeout issues
Lower session.expiration or increase session.inactivity in Authelia. In Authentik, adjust under Flows → default-authentication-flow → Session Duration.
2FA not prompting
Ensure the access control policy is set to two_factor (Authelia) or that the Authentik flow includes an MFA stage.
Recommended Hardware
If you’re running Authentik (which is more resource-heavy), consider a dedicated mini PC or a server with at least 4 GB RAM:
- Search for Intel N100 Mini PCs on Amazon — great for budget homelabs
- Search for Beelink Mini PCs on Amazon — solid performance, low power
For Authelia, even a Raspberry Pi 4 will handle it comfortably.
Conclusion
Both Authelia and Authentik are excellent self-hosted SSO solutions. Choose Authelia if you want a lightweight, configuration-file-based setup that integrates seamlessly with reverse proxies. Choose Authentik if you need a full-featured identity provider with a web UI, OAuth2/SAML support, and built-in user management.
Either way, adding SSO to your homelab is one of the best security improvements you can make. Single login, centralized 2FA, and better access control across all your services.
Next steps:
- Set up either Authelia or Authentik
- Enable 2FA for your admin account
- Protect your most important services (Nextcloud, Grafana, etc.)
- Consider adding LDAP for centralized user management
Your homelab just got a lot more secure.