Customizing Jenkins login session timeout

Article ID:4406750806427
1 minute readKnowledge base

Issue

You want to customize the Jenkins login session timeout, to increase or decrease the length of time before a logged-in user is automatically logged out.

Resolution

In current versions of Jenkins (since 2.117) there are two command line arguments that control the login session timeout. Both of these may need to be set, depending on your desired outcome:

  • sessionTimeout is set in minutes; a user will be logged out after this time, no matter what. Default is 30 minutes.

  • sessionEviction is set in seconds; a user will be logged out after this time if their session is idle. Default is 30 minutes.

Prior to version 2.117 there was only the sessionTimeout option.

These arguments need to be passed to the Jenkins war file, NOT to the JVM. This article explains where the arguments should be added, depending on the OS/distribution you are using.

As an example, if you wanted to set the timeout for idle sessions to 1 hour and active sessions to 2 hours, you would use:

--sessionTimeout=120 --sessionEviction=3600