<p>Yes! The setting is called <a href="https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#usersessionduration" rel="nofollow noreferrer"><code>userSessionDuration</code></a>, and you can set it in your <code>general.php</code> config file, on a per-environment basis.</p>
<p><a href="https://docs.craftcms.com/api/v3/craft-helpers-confighelper.html#method-durationinseconds" rel="nofollow noreferrer">Here's an explanation</a> of the values that you can use for the setting—for posterity: integers (in seconds), a PHP duration expression, an initialized <code>DateInterval</code> object, or <code>0</code> for &quot;indefinite.&quot;</p>
<p>The link above points to the Craft 3 documentation, but <a href="https://docs.craftcms.com/v2/config-settings.html#usersessionduration" rel="nofollow noreferrer">the same setting</a> is available in Craft 2.</p>

CC BY-SA 4.0
2018-06-20T22:49:32.963Z
2022-02-01T11:52:35.023Z
2022-02-01T11:52:35.023Z
August Miller
<p>Our users are getting logged out after 1 day.</p>

<p>Is there a setting that changes how long users’ sessions will last?</p>

<users><config><session>
Is it possible to change the amount of time a user stays logged in for?
# Is it possible to change the amount of time a user stays logged in for?

(Asked by: username_0 on 2018-06-20)

Our users are getting logged out after 1 day.

Is there a setting that changes how long users’ sessions will last?

**Tags:** users, config, session


---

## 1 answers

### Answer by username_1 on 2018-06-20. Score: 3 | Accepted answer

Yes! The setting is called [`userSessionDuration`](https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#usersessionduration), and you can set it in your `general.php` config file, on a per-environment basis.

[Here's an explanation](https://docs.craftcms.com/api/v3/craft-helpers-confighelper.html#method-durationinseconds) of the values that you can use for the setting—for posterity: integers (in seconds), a PHP duration expression, an initialized `DateInterval` object, or `0` for "indefinite."

The link above points to the Craft 3 documentation, but [the same setting](https://docs.craftcms.com/v2/config-settings.html#usersessionduration) is available in Craft 2.


---

