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 might have been introduced for security reasons.
The relevant code is in
* Set session cookie lifetime to session duration
* @return $this
protected function configureCookieLifetime()
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(
return [$lifetime, \Magento\Framework\Session\Config::COOKIE_LIFETIME_DEFAULT];
$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.