Increase the Jenkins login timeout

后端 未结 8 785
死守一世寂寞
死守一世寂寞 2020-12-07 17:39

Does anyone know how to increase the the timeout window before Jenkins logs out a user? I\'m looking to raise it to 1 day or so.

I work in and out jenkins all day a

相关标签:
8条回答
  • 2020-12-07 18:05

    it also seems possible to set it using groovy console:

    import org.kohsuke.stapler.Stapler;
    Stapler.getCurrentRequest().getSession().setMaxInactiveInterval(TIME_IN_SECONDS)
    

    But I guess it will only be available for current session

    0 讨论(0)
  • 2020-12-07 18:07

    For Ubuntu:

    nano /etc/default/jenkins
    

    Append to JENKINS_ARGS at the end of the file:

    JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --sessionTimeout=1440 --sessionEviction=43200"
    
    0 讨论(0)
  • 2020-12-07 18:08

    As of 1.528 you can use the --sessionTimeout <minutes> parameter when starting up jenkins via an init script. If starting the war, pass in -DsessionTimeout=<minutes>

    Update for 1.6

    If passing in as an arg use --sessionTimeout=<minutes>

    0 讨论(0)
  • 2020-12-07 18:13

    Jenkins uses Jetty, and Jetty's default timeout is 30 minutes. This is independent of authentication settings -- I use Active Directory but it's still this setting that affects timeouts.

    You can override the timeout by passing an argument --sessionTimeout=<minutes> to the Jenkins init script, or -DsessionTimeout=<minutes> to the .war file. For example:

    # Set the session timeout to 1 week
    $ java -jar jenkins.war --sessionTimeout=10080
    

    Alternatively, you can edit Jenkins' <jenkinsHome>/.jenkins/war/WEB-INF/web.xml and add explicitly set it:

    <session-config>
      <!-- one hour -->
      <session-timeout>60</session-timeout>
    </session-config>
    

    According to Oracle's docs you can set this to 0 to disable timeouts altogether.

    To find out the current value for timeouts, you can use the Groovy console provided in Jenkins:

    import org.kohsuke.stapler.Stapler;
    Stapler.getCurrentRequest().getSession().getMaxInactiveInterval() / 60
    

    On my instance, this shows Result: 30.

    0 讨论(0)
  • 2020-12-07 18:24

    This version of Jenkins 1.567 also has the enable auto refresh option so it somehow keeps refreshing the session and I never get logged out. It works for me...

    0 讨论(0)
  • 2020-12-07 18:24

    On my Linux distro, this setting can be added to /etc/sysconfig/jenkins

    # Pass arbitrary arguments to Jenkins.
    # Full option list: java -jar jenkins.war --help
    #
    JENKINS_ARGS="--sessionTimeout=480"
    

    Subsequently, restart with

    sudo /etc/init.d/jenkins restart
    
    0 讨论(0)
提交回复
热议问题