What is cpsess in cPanel & WHM?
16.04.2025
What is cpsess in cPanel & WHM?
cpsess is a session token used by cPanel, WHM, and Webmail for secure authentication. It is added to URLs to maintain an authenticated session while preventing cross-site request forgery (CSRF) attacks.
For other cpanel-stack topics, see cpsrvd — cPanel Service Daemon Guide and "Installation already exists" — Softaculous Reinstall Fix.
Example of a cpsess URL in cPanel:
https://yourserver.com:2083/cpsess1234567890/frontend/paper_lantern/index.html
cpsess1234567890> This is the session token.- It ensures that users remain logged in securely without repeatedly entering passwords.
Why is cpsess Used?
- Prevents session hijacking by generating a unique token.
- Protects against CSRF attacks by ensuring requests originate from authenticated users.
- Improves security by making session URLs temporary and specific to each login.
Common Issues and Fixes for cpsess
Issue: "Invalid cpsess session" or Logout After Login
Cause: The session token expired or was invalidated.
Fix:
- Clear Browser Cache and Cookies
Open browser settings > Clear cookies & cache. - Ensure Cookies Are Enabled
Some security extensions may block cookies. Disable them. - Check for IP Changes
If your ISP changes your IP frequently, enable "Cookie IP Validation: Loose" in WHM:
WHM > Tweak Settings > Cookie IP Validation > Loose - Restart cPanel Services
orsudo systemctl restart cpanel
/usr/local/cpanel/scripts/restartsrv_cpsrvd
Issue: Redirect Loop with cpsess in URL
Cause: Corrupted session or incorrect redirection settings.
Fix:
- Try Incognito Mode or another browser.
- Remove cpsess from URL and try accessing:
https://yourserver.com:2083/ - Restart Apache and cPanel services
sudo systemctl restart httpd sudo systemctl restart cpanel
Issue: "Session Timeout" or "Invalid Security Token" in cPanel/WHM
Cause: Sessions are expiring too quickly.
Fix:
- Increase session timeout in WHM:
WHM > Tweak Settings > Session Timeout (Set to 30+ minutes) - Ensure disk space is not full:
Ifdf -h/tmpor/homeis full, clear unnecessary files.
How to Manually Invalidate cpsess Sessions
If you need to force logout all cPanel/WHM users:
rm -rf /var/cpanel/session_cleanup/*
Then restart the cPanel service:
sudo systemctl restart cpanel
Summary
| Issue | Solution |
|---|---|
| cpsess invalid session | Clear cache, restart cPanel services |
| Redirect loop with cpsess | Try incognito mode, remove cpsess from URL |
| "Session Timeout" | Increase timeout in WHM, check disk space |
| Force logout all users | Delete session files in /var/cpanel/session_cleanup/ |
By following these steps, you can fix cpsess session issues and ensure secure cPanel/WHM access.


