Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set login timeout to disconnect automatically in linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to set the login timeout in linux to automatically disconnect, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

I. Project description

In order to enhance the security of the linux system, the user needs to disconnect automatically after the user operation is idle for a period of time.

II. Demand analysis

This can be done by setting the TMOUT value.

You can add the TMOUT field to / etc/profile (effective for all users).

III. Solutions

1 system information

[root@fs-3z3-vm0326 bin] # uname-a

Linux fs-3z3-vm0326 3.10.0-693.el7.x86_64 # 1 SMP Tue Aug 22 21:09:27 UTC 2017 x86'64 GNU/Linux

[root@fs-3z3-vm0326 bin] # cat / etc/issue

\ s

Kernel\ r on an\ m

[root@fs-3z3-vm0326 bin] # vi / etc/profile

[root@fs-3z3-vm0326 bin] # cat / etc/profile | grep TMOUT-n-- View timeout parameter TMOUT

77:TMOUT=180

2 add content to / etc/profile

Export TMOUT=180 # set the field to disconnect the terminal within 180 seconds if the user has no action.

Readonly TMOUT # set the value to readonly to prevent users from changing

/ / the following content comes from the network

Note: after setting readonly, it cannot be canceled under the current shell. You need to comment or delete the readonly line set in / etc/profile first, and then login again after logout.

$export TMOUT=900

$readonly TMOUT

$unset TMOUT

-bash: unset: TMOUT: cannot unset: readonly variable

The above is how to set login timeout to disconnect automatically in linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report