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.
From:http://www.adercon.com/ac/node/39
Changing the Auto-Logout Timeout in SSH的更多相关文章
- MES Auto Logout
如果您在车间使用MES,可能存在这种情况有人在仍然登录的情况下偶尔离开终端.如果一段时间不使用终端,我们是否可以让用户自动注销. 1 首先,我们有一条using语句: using System.Run ...
- linux shell except tcl login ssh Automatic interaction
/*************************************************************************************** * linux she ...
- cisco ssh实验--附带配置脚本-2019.11.19
cisco ssh实验
- SSH自动登录脚本
原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11926792.html vi app-stg.sh #!/usr/bin/expect -f #aut ...
- 自动化运维,远程交互从服务器A上ssh到服务器B上,然后执行服务器B上的命令。
第一种: ftp -v -n 192.168.0.1 21 <<! user ftp ftp123 bay ! 第二种: { echo -e "\n" echo -e ...
- golang的ssh包
git clone https://github.com/golang/crypto.git,复制到 golang.org/x/ 目录下. 常常用来建立ssh连接发送一条命令,但有时需要模拟ssh客户 ...
- 关于Mac下的SSH客户端iterm2等配置
linux后台开发的同学们晓得,在windows下有xshell\securecrt这样优秀的ssh客户端软件.mac下查找了下,有securecrt mac版,网上也有破解的,试用了一段时间,一个问 ...
- python ssh弱口令爆破多线程脚本及遇到的一些错误与问题
练习写了个SSH弱口令爆破多线程脚本,遇到的问题 1.一开始想import pexpect 中的pxssh 然而却一直该有错误, ImportError: cannot import name spa ...
- Net::SSH::Perl 模块
<pre name="code" class="python">Net::SSH::Perl - Perl client Interface to ...
随机推荐
- JAVA 从GC日志分析堆内存 第七节
JAVA 从GC日志分析堆内存 第七节 在上一章中,我们只设置了整个堆的内存大小.但是我们知道,堆又分为了新生代,年老代.他们之间的内存怎么分配呢?新生代又分为Eden和Survivor,他们的比 ...
- leetcode Swap Nodes in Pairs python
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = ...
- Twisted No module named win32api
安装twisted成功后,使用时抛错: No module named win32api 解决方案,需要安装 pywin32 下载地址: https://sourceforge.net/project ...
- Windows Server 2008防火墙问题及Sql Server2005用户登录问题
一.Windows Server 2008防火墙问题 1. 问题: 1.在 Windows 安全中心中单击“立即打开”以打开 Windows 防火墙时,会收到以下错误消息:安全中心无法打开 Wind ...
- Python进阶之返回函数
返回函数 .note-content {font-family: "Helvetica Neue",Arial,"Hiragino Sans GB"," ...
- js屏蔽浏览器(IE和FireFox)的刷新和右键等功能
//一.js屏蔽浏览器(IE和FireFox)的刷新功能 document.onkeydown=function() { if ((window.event.keyCode==116)|| //屏蔽 ...
- IP地址获取到为0:0:0:0:0:0:0:1
引用 13 楼 oXiaoShe 的回复: Quote: 引用 11 楼 ahjsdzm 的回复: [Quote=引用 9 楼 huazaiyou 的回复:]最近在进行web开发时,遇到了reques ...
- Android软件版本更新
转的:适合新手学习,但在实际项目中不可这么做. 以下是我转的内容: ================================================================= ...
- 关于使用WKWebViewJavascriptBridge报错的问题
Error message: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_WKWebViewJavascriptBrid ...
- 提高你的Java代码质量吧:使用构造函数协助描述枚举项
一.分析 一般来说,我们经常使用的枚举项只有一个属性,即排序号,其默认值是从0.1.2... ....但是除了排序号外,枚举还有一个(或多个)属性. 二.场景 比如,可以通过枚举构造函数声明业务值,定 ...