Extend Your Session Logout Time in Magento 2

Getting logged out of the Magento admin panel while working on something? The default session timeout is 900 seconds (15 minutes), which can be frustrating during longer tasks. This guide shows you how to extend it.

Quick Configuration

Via Admin Panel

  1. Go to Stores → Configuration
  2. Navigate to Advanced → Admin → Security
  3. Find Admin Session Lifetime (seconds)
  4. Enter your preferred duration in seconds
  5. Click Save Config
  6. Clear cache

Common Values

Duration Seconds
15 minutes (default) 900
30 minutes 1800
1 hour 3600
2 hours 7200
4 hours 14400
8 hours 28800

Via Command Line

You can also set this via CLI:

bin/magento config:set admin/security/session_lifetime 7200
bin/magento cache:flush

Security Considerations

While longer sessions are convenient, they also increase security risk:

  • Public or shared computers - Keep timeout short (15-30 min)
  • Private workstation - Longer timeout is acceptable (2-4 hours)
  • PCI compliance - May require specific timeout limits

Recommendation: Don't exceed 4 hours (14400 seconds). If you need longer sessions, consider why and whether it's a security concern.

Password Lifetime

How long before admin passwords must be changed:

Location: Stores → Configuration → Advanced → Admin → Security → Password Lifetime (days)

Set to 0 to disable forced password changes.

Maximum Login Failures

Lock account after failed login attempts:

Location: Stores → Configuration → Advanced → Admin → Security → Maximum Login Failures to Lockout Account

Default is 6 attempts.

Lockout Time

How long account stays locked:

Location: Stores → Configuration → Advanced → Admin → Security → Lockout Time (minutes)

Default is 30 minutes.

Frontend Session Timeout

Customer sessions are separate from admin sessions. To adjust frontend session timeout:

  1. Go to Stores → Configuration
  2. Navigate to Customers → Customer Configuration → Online Customers Options
  3. Adjust Online Minutes Interval

Or for cookie lifetime:

Stores → Configuration → General → Web → Default Cookie Settings → Cookie Lifetime

Troubleshooting

Still Getting Logged Out

If you're still being logged out despite increasing the timeout:

  1. Check PHP session settings - session.gc_maxlifetime in php.ini should be >= your Magento setting
  2. Check Redis/session storage - If using Redis for sessions, verify TTL settings
  3. Check load balancer - Some load balancers have their own timeout settings
  4. Browser extensions - Some security extensions clear cookies

Setting Not Saving

If the configuration doesn't save:

bin/magento cache:flush
bin/magento config:show admin/security/session_lifetime

Check if value is locked in app/etc/config.php or env.php.

If sessions work but cookies don't persist:

  1. Check cookie domain settings in Stores → Configuration → General → Web → Default Cookie Settings
  2. Ensure your domain matches the cookie domain
  3. Check for HTTPS/HTTP mismatches

Need More Help?

Documentation:

Support:

Article Updated:
star star star star star
star star star star star
Alexandru-Manuel Carabus
Magmodules sets the bar for Magento module quality and support—we check their catalog first for client feature requests, and they’re our first choice for licenses.
Google 11 Nov 2025
star star star star star
star star star star star
Matt Austin
Possibly the fastest support response times of any Magento Extension vendor. Great extensions too!
Google 09 Sep 2025
star star star star star
star star star star star
Jan Privé
Dankzij de heldere uitleg en snelle reactie van Magmodules kon mijn vraag, en dus mijn Magento-probleem, binnen enkele uren worden beantwoord. Doeltreffend, zonder moeilijke termen, gewoon zo als het zou moeten zijn.... Bedankt!
Google 05 Sep 2025
star star star star star
star star star star star
Denis Metzler
To evaluate a provider, it is not enough to consider only the product offered, but also its after-sales service, such as support and troubleshooting. Magmodules has been extremely satisfactory at all levels on multiple occasions and sets the bar at the top when comparing the competition.
Google 02 Sep 2025
star star star star star
star star star star star
Bleijenberg winkelinrichting en materialen
Goed bereikbaar, reageren snel en denken oplossingsgericht. Een aanrader.
Google 30 Jul 2025
star star star star star
star star star star star
Patrick Verduijn
Magmodules biedt plugins aan die van hoge kwaliteit zijn tegen een goede prijs, waar dit bedrijf in uitblinkt is de bereidheid om de zeldzame feedback & problemen met de plugins te willen onderzoeken, mee te willen denken in het debuggen van problemen en goede oplossingen toe te passen. In mijn decennium ervaring met Magento & 3th parties is Magmodules absoluut een uniqum binnen de markt.
Google 25 Jul 2025
star star star star star
star star star star star
Erik de Groot
Magemodules heeft hele sterke Magento extensies en een proactieve support. Al jaren heel erg tevreden over jullie service en producten!
Google 18 Jul 2025
star star star star star
star star star star star
René Zeuner
We are using the Mollie Magento extension from Magmodules. It works excellently without flaws. Very fast, competent and friendly support. Thanks!
Google 30 Jun 2025
star star star star star
star star star star star
R. U.
Erg goed team, reageren snel en duidelijk en hebben met toegang tot onze database erg goed geholpen (eigenlijk een gratis customization).
Google 18 Jun 2025
star star star star star
star star star star star
Hugo de Groot
Uitstekende support! Wij gebruiken o.a. de Rich Snippets Suite extensie voor onze Magento 2 webshop (Hyvä) en hadden een specifieke vraag over structured data op PLP-pagina’s. Binnen no-time kregen we een inhoudelijk en duidelijk antwoord. Zeer prettig contact en goed onderbouwde uitleg. Absoluut een betrouwbare partner voor Magento-extensies!
Google 13 Jun 2025