29

It is possible that sometimes the time that the admin session is active is too short.

How to change the time it takes to auto-logoff the user from the back-end?

28

There's an menu item for this in:

System > Configuration > Advanced > Admin > Security > Session Lifetime (Seconds)

Also check the php environment variables

  • php_value session.cookie_lifetime <seconds>
  • php_value session.gc_maxlifetime <seconds>

In order to ensure that you are editing the correct php.ini, create a simple "check.php" file with the following content:

<?php 
phpinfo();
?>

, place the file in your magento home directory, call it from your browser (URL/check.php) and check these settings.

For more informations look here.

| improve this answer | |
16

Solution for Magento 2.0

For Magento 2 it can be found in Left Hand Panel on the Admin.

Stores > Configuration > Advanced > Admin > Security

Admin Session Lifetime (seconds) option in the main window.

Default value is 900 for Magento 2. For 1 hour set to 3600 (60seconds * 60minutes).

You must configure this on the "Default Config" instead of selecting a website or store view for your store view option. I tried to use it on a store view via the drop down menu in the top left and the option is not there. It does make sense since it is an administration configuration.

Note that this setting does not have any effect on the cookie lifetime at least since Magento 2.1

| improve this answer | |
  • Seems to be working for me on 2.1 right now, at least in developer mode if that matters. – Aaron McMillin Sep 27 '16 at 17:12
  • Broken in 2.1.1, always session cookie – Alex Nov 14 '16 at 13:37
  • It works for my Magento v.2.3.1 – kanenas Oct 3 '19 at 9:12
4

Another simple solution without modifing any settings is install any auto refresh addon for your browser and set its time (60 seconds).

It will auto refresh the page for every 6o seconds which prevents session lifetime to expire and we can start working on another tab.

I used Easy Auto Refresh and it works fine for me.

| improve this answer | |
2

System -> Configuration -> General -> Web -> Session Cookie management

Cookie Lifetime: Change this value (i.e.: 86400).

| improve this answer | |
  • 8
    Sorry, but this is the value for the session lifetime in the frontend (shop). The admin session lifetime can be set via System > Configuration > Advanced Section > Admin > Session Lifetime (seconds). Set it to 3600 (60 seconds * 60 minutes) for a lifetime of one hour. – Anna Völkl Jul 16 '14 at 6:25
  • @AnnaVölkl I've wrote a detail post on this. magento2training.com/… – Nahid May 8 '18 at 2:55
2

Check attached image screenshot below from Magento 2 admin panel to setup session for login user. enter image description here

| improve this answer | |
2

Solution for Magento 2.1+

Since Magento 2.1 the admin session lifetime is always "session", i.e. until the browser is closed. This has been introduced for security reasons.

The relevant code is in Magento\Backend\Model\Session\AdminConfig:

/**
 * Set session cookie lifetime to session duration
 *
 * @return $this
 */
protected function configureCookieLifetime()
{
    return $this->setCookieLifetime(0);
}

If you want to change this behavior, you can add a plugin for this class with the following interceptor method:

public function beforeSetCookieLifetime()
{
    $lifetime = $this->scopeConfig->getValue(
        \Magento\Framework\Session\Config::XML_PATH_COOKIE_LIFETIME,
        \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
    return [$lifetime, \Magento\Framework\Session\Config::COOKIE_LIFETIME_DEFAULT];
}

Where $this->scopeConfig should be an instance of \Magento\Framework\App\Config\ScopeConfigInterface, injected via constructor parameter.

This way the cookie lifetime is used from configuration, just as in the frontend.

Note that the configuration in Stores > Configuration > Advanced > Admin Security > Session Lifetime does not have any effect on the cookies anymore! It is used to determine Redis session lifetime, so if you increase the cookie lifetime, you should also increase this value.

| improve this answer | |
1

Sunovisio actually provide an extension that allows you to keep your administration session alive while you are working on and that independently of your session timeout.

You can check it there: http://ecommerce.sunovisio.com/index.php/admin-keep-alive-1-1-0.html

Hope this extension will help you working with your Magento Administration Panel!

| improve this answer | |
1

In MySQL:

table: core_config_data

path: admin/security/session_lifetime

| improve this answer | |
0

yes, but first you have to make sure that magento location and the server time are in the same timezone. also make sure there are no any session.* overrides in php.ini

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.