天天看點

設定Linux系統的空閑等待時間TMOUT

為了增強linux系統的安全性,我們需要在使用者輸入空閑一段時間後自動斷開,這個操作可以由設定tmout值來實作。将以下字段加入到/etc/profile 中即可(對所有使用者生效)。

export tmout=900    # 設定900秒内使用者無操作就字段斷開終端

readonly tmout     # 将值設定為readonly 防止使用者更改

注意:設定了readonly 之後在目前shell下是無法取消的,需要先将/etc/profile 中設定readonly行注釋起來或直接删除,logout 後重新login 。

$ export tmout=900

$ readonly tmout

$ unset tmout

-bash: unset: tmout: cannot unset: readonly variable

轉:http://zzkai.blog.51cto.com/804611/1352964