Set a Timeout for Inactive Sessions
Cockpit, by default, doesn't automatically expire inactive user sessions. To prevent unauthorized use of an unattended session, consider specifying a duration for when inactive user sessions expire.
What Do You Need?
- The Cockpit web console must be installed and accessible.
For details, see these topics: Install and Enable Cockpit and Log in to the Cockpit Web Console.
- An existing
cockpit.conf
file must be saved in the/etc/cockpit/
directory.Important:
The Cockpit configuration file (cockpit.conf
) isn't a system required or provided file. In cases where it doesn't already exist, you must manually create the file before performing the steps in this procedure. For more details about the use of this file, see thecockpit.conf(5)
manual page. - Administrator privileges.
Steps
Using the Cockpit Terminal CLI, perform the following steps to configure a session idle timeout duration in the Cockpit configuration file.
- In the Cockpit navigation pane, click Terminal.
- In the Terminal page, open the
cockpit.conf
file in the/etc/cockpit/
directory in a text editor. For example:sudo vi /etc/cockpit/cockpit.conf
- Add the following information to the
cockpit.conf
file:[Session] IdleTimeout=value
The
IdleTimeout
property specifies how many minutes until an inactive user session in Cockpit is automatically logged out. - To set the
IdleTimeout
property, perform one of the following:- To disable the
IdleTimeout
property, set the value to 0. For example:IdleTimeout=0
-OR-
- To enable the
IdleTimeout
property, set the value to reflect the number of minutes allowed before a user session times out. For example, to set an hour of inactivity before a user is logged out, you would set the value to 60. (IdleTimeout=60
).
- To disable the
- Save the changes to
cockpit.conf
file. - Restart Cockpit for the configuration file changes to take effect.
sudo systemctl try-restart cockpit