Auto Logout from web interface not working

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 20.0.8
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41 (Ubuntu)
PHP version (eg, 7.4): PHP 7.4.3

The issue you are facing:
When logging into Nextcloud on the web interface, the server never logs out the user automatically after any period of time. Is there a way to fix this so that if I a user is inactive on the web interface the systems logs out them out after 30 minutes of inactivity?

I searched in the forums and added a few lines to the config.php file in /var/xxx/nextcloud/config, but I am not getting any positive results. I am obviously doing something wrong. These are the lines I added:

‘remember_login_cookie_lifetime’ => 1296000,
‘session_lifetime’ => 43200,
‘session_keepalive’ => false,
‘auto_logout’ => false,

What am I doing wrong? How do I fix the problem? Thanks!

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Login as either admin or user to Nexcloud web interface
  2. Remain inactive for any period of time
  3. Open web address of web interface after being inactive and instead of login page you are directed to user’s logged interface

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.example.com',
  ),
  'datadirectory' => '/var/www/nextcloud-data/',
  'dbtype' => 'mysql',
  'version' => '20.0.8.1',
  'overwrite.cli.url' => 'https://nextcloud.example.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'pipe',
  'mail_from_address' => 'xxx',
  'mail_domain' => 'example.com',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'localhost',
  'mail_smtpport' => '1025',
  'mail_smtpname' => 'xxx@example.com',
  'mail_smtppassword' => 'xxx',
  'mail_smtptimeout' => 30,
  'remember_login_cookie_lifetime' => 1296000,
  'session_lifetime' => 43200,
  'session_keepalive' => false,
  'auto_logout' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'maintenance' => false,
  'updater.release.channel' => 'stable',
  'theme' => '',
  'loglevel' => 2,
);

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Hi DonDowner,
di you try
‘auto_logout’ => true, ?

The manual says:
Enable or disable the automatic logout after session_lifetime, even if session keepalive is enabled. This will make sure
that an inactive browser will be logged out even if requests to the server might extend the session lifetime.

Hope, it helps.
Soyo

Thank you Soyo. I just updated with the following lines:

‘remember_login_cookie_lifetime’ => 1296000,
‘session_lifetime’ => 1800,
‘session_keepalive’ => false,
‘auto_logout’ => true,

Should I restart something to make the changes go into effect? If so, can you please tell me how? Thanks.

It works now. I didn’t have to restart any services. Thank you.

1 Like