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的更多相关文章

  1. MES Auto Logout

    如果您在车间使用MES,可能存在这种情况有人在仍然登录的情况下偶尔离开终端.如果一段时间不使用终端,我们是否可以让用户自动注销. 1 首先,我们有一条using语句: using System.Run ...

  2. linux shell except tcl login ssh Automatic interaction

    /*************************************************************************************** * linux she ...

  3. cisco ssh实验--附带配置脚本-2019.11.19

    cisco ssh实验

  4. SSH自动登录脚本

    原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11926792.html vi app-stg.sh #!/usr/bin/expect -f #aut ...

  5. 自动化运维,远程交互从服务器A上ssh到服务器B上,然后执行服务器B上的命令。

    第一种: ftp -v -n 192.168.0.1 21 <<! user ftp ftp123 bay ! 第二种: { echo -e "\n" echo -e ...

  6. golang的ssh包

    git clone https://github.com/golang/crypto.git,复制到 golang.org/x/ 目录下. 常常用来建立ssh连接发送一条命令,但有时需要模拟ssh客户 ...

  7. 关于Mac下的SSH客户端iterm2等配置

    linux后台开发的同学们晓得,在windows下有xshell\securecrt这样优秀的ssh客户端软件.mac下查找了下,有securecrt mac版,网上也有破解的,试用了一段时间,一个问 ...

  8. python ssh弱口令爆破多线程脚本及遇到的一些错误与问题

    练习写了个SSH弱口令爆破多线程脚本,遇到的问题 1.一开始想import pexpect 中的pxssh 然而却一直该有错误, ImportError: cannot import name spa ...

  9. Net::SSH::Perl 模块

    <pre name="code" class="python">Net::SSH::Perl - Perl client Interface to ...

随机推荐

  1. C#:判断一个String是否为数字

    方案一:Try...Catch(执行效率不高)private bool IsNumberic(string oText){          try         {                 ...

  2. Java SE基础部分——常用类库之NumberFormat(数字格式化)

    数字格式化常用方法:DecimalFormat和NuberFormat. //2016060524 数字格式化学习 //数字格式化 两种方法 一种直接使用NumberFormat,另一种Decimal ...

  3. Java中Overload和Override的区别

    由于项目正式收工,闲来无事突然发现以前的文档上有一个问题介绍的不是很详细 override(重写,覆盖) ​​ 1.方法名.参数.返回值相同. ​2.子类方法不能缩小父类方法的访问权限. 3.子类方法 ...

  4. HTMLのフォームの送信ボタンは、inputとbuttonでは機能的な違いがありますか?

    (X)HTMLのフォームの送信ボタンは.inputとbuttonでは機能的な違いがありますか? <input type="submit" value="送信&quo ...

  5. GO语言搭建

    最近对GO语言产生了浓厚的兴趣.因为GO语言不仅仅可以开发桌面.web程序,最吸引我的是安卓大有往GO语言全方位靠拢的趋势,自家的系统还是用自家的语言开发比较靠谱. 用一句话来说:Go语言是谷歌200 ...

  6. 6. java.lang.IllegalArgumentException

    方法的参数错误 比如g.setColor(int red,int green,int blue)这个方法中的三个值,如果有超过255的也会出现这个异常,因此一旦发现这个异常,我们要做的,就是赶紧去检查 ...

  7. ios jsbrige

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  8. Quality Over Quantity: 更少一些,更好一些_第1页_福布斯中文网

    Quality Over Quantity: 更少一些,更好一些_第1页_福布斯中文网     Quality Over Quantity: 更少一些,更好一些    2013年04月09日     ...

  9. 【MongoDB数据库】MongoDB 命令入门初探

    MongoDB是一款NoSql数据库,使用了"面向集合"(Collection-Oriented)原理,意思是数据被分组存储在数据集中,被称为一个集合(Collection).每一 ...

  10. poj 1469(二分图 最大匹配)

    这道题让我认识到了c++cin,cout确实会使其超时,还是我用的c printf吧 #include<cstdio> #include<iostream> #include& ...