本篇文章為大家展示了linux中怎么設置登錄超時自動斷開,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。
一、項目描述
用戶為了增強linux系統的安全性,需要在用戶操作空閑一段時間后自動斷開。
二、需求分析
這個操作可以由設置tmout值來實現。
可tmout字段加入到/etc/profile 中即可(對所有用戶生效)。
三、解決方案
1系統信息
[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 x86_64 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 --查看超時時間參數tmout
77:tmout=180
2在/etc/profile中添加內容
export tmout=180 # 設置180秒內用戶無操作就字段斷開終端
readonly tmout # 將值設置為readonly 防止用戶更改
//以下內容來源于網絡
注意:設置了readonly 之后在當前shell下是無法取消的,需要先將/etc/profile 中設置readonly行注釋起來或直接刪除,logout 后重新login 。
$ export tmout=900
$ readonly tmout
$ unset tmout
-bash: unset: tmout: cannot unset: readonly variable
企業建設品牌網站,這些事一定要知道關于網站SEO優化關鍵詞排名的五大重點你知道幾個?建筑設計行業網站策劃SEO如何注重優化網頁打開速度?分析企業網站制作頁面放置視頻的注意事項有哪些高端營銷型網站建設需要如何去定位如何設計手機網站設計者要注意這五點云服務器選購一定要留意這些方面