基线加固设置 ssh登录空闲超时登出TMOUT

短命女 2022-11-01 13:51 204阅读 0赞

检查方法:

  1. cat /etc/profile |grep TMOUT
  2. cat /etc/profile |grep export TMOUT
  3. cat /etc/csh.cshrc |grep autologout
  4. \#查看profile文件中TMOUT的值,该值的单位为秒,空闲超时登出。

加固步骤:

#备份文件

  1. cp p /etc/profile /etc/profile\_bak
  2. cp p /etc/csh.cshrc /etc/csh.cshrc\_bak

#修改文件

  1. sed i 's/TMOUT=0/TMOUT=300/g' /etc/profile
  2. echo 'set autologout=30' >> /etc/csh.cshrc
  3. readonly TMOUT \# 将值设置为readonly 防止用户更改。当前shell下是无法取消,修改需/etc/profile 注释readonly

临时关闭:

  1. unset TMOUT

发表评论

表情:
评论列表 (有 0 条评论,204人围观)

还没有评论,来说两句吧...

相关阅读