Changing the Auto-Logout Timeout in SSH
SSH:
We can set a timeout interval for ssh client who are idle or in inactive state. As soon as the idele user will reach the timeout interval, they will be logged off from server automatically
To set this up, you just need to perform some simple steps:
1) Open the file /etc/ssh/sshd_config which is ssh server configuration file and search the below given parameters and change them to read as:
ClientAliveInterval 180 ClientAliveCountMax 0
180 represents the no. of seconds after which the clients will be logged out if they idle. You can change it as per your need.
Save and close the file.
2) Now, restart sshd service:
[root@server ~]# service sshd restart [root@server ~]# chkconfig sshd on
3) Thats it, now whenever a ssh client will be idle for 180 seconds i.e. 3 minutes, he will be automatically logged out by getting a message like this:
[root@server5 ~]# timed out waiting for input: auto-logout Connection to 192.168.0.105 closed.
- See more at: http://www.switchroot.com/how-to-log-out-idle-ssh-clients-automatically#sthash.UnsbQR2d.dpuf
From:http://www.switchroot.com/how-to-log-out-idle-ssh-clients-automatically
The ssh "timed out waiting for input: auto-logout" messages is generated by ssh upon reaching a auto-logout after an inactivity time specified by the TMOUT environment variable. If this variable is not set your session will not be auto-logged out due to inactivity. If the environment variable is set, your session will be automatically closed/logged out after the amount of seconds specified by the TMOUT variable.
To see if your auto-logout variable is set and/or see what it is set to issue the following command:
$ echo $TMOUT
Often this value is defined in /etc/profile (globally) or your user's profile (~/.profile or ~/.bash_profile).
To alter the auto-logout amount, set the TMOUT environment variable accordingly:
* TMOUT=600 #set an auto-logout timeout for 10 minutes
* TMOUT=1200 #set an auto-logout timeout for 20 minutes
* TMOUT= #turn off auto-logout (user session will not auto-logout due to session inactivity)
This value can be set globally (e.g. TMOUT=1200) in the /etc/profile file; however, each user can override the value by setting the TMOUT variable in their personal profile file (~/.profile or ~/.bash_profile). To do this simply set the TMOUT variable as you like in your profile file.
Dont forget to source the file you changed to get the settings to take effect immediately or log out and log back in.
相关文章
- #化鲲为鹏,我有话说# 鲲鹏云服务器的使用小技巧之SSH(一)
- ssh免密不成功-比较怪异的一台机器
- Windows 下安装 SSH 服务(Openssh)
- ssh(Spring+Spring mvc+hibernate)——updateDept.jsp
- centos7操作SSH/SSHD服务(查看/启动/重启/自启)
- FAIL : SSHException: Incompatible ssh peer (no acceptable kex algorithm)问题解决及更新paromiko失败问题解决
- ssh-keygen 的使用
- SSH使用ssh-keygen远程登录主机免输入密码
- sharepoint2010:The number of items in this list exceeds the list view threshold, which is 20000 items.
- 解决ssh暴力破解服务器密码
- Unexpected XML declaration. The XML declaration must be the first node in the document and no white
- Spark SQL 源代码分析之 In-Memory Columnar Storage 之 in-memory query
- 如何设置 ssh secure shell 支持中文
- L70.linux命令每日一练 -- 第十章 Linux网络管理命令 -- nc和ssh
- ubuntu 16.04.7 LTS 修改 ssh默认端口号 ssh服务重新启动不了
- JumpServer ssh client
- macOS 修改SSH配置允许root登陆
- ssh tunnel 上网
- ssh-copy-id三步实现SSH无密码登录和ssh常用命令
- Hadoop入门(四):SSH免密登录 配置
- 【过程记录】ssh配置免密登录/anaconda环境迁移/gcc_g++安装切换
- Centos 7.5 SSH改别的端口连接不上,只有默认端口才行(未解决)
- git报错:ssh variant 'simple' does not support setting port解决