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. TestLink测试软件安装条件检查不通过的解决方案

    在第一次安装的时候出现这个错误信息 解决办法: 修改config.inc.php文件里的两个属性值为: $tlCfg->log_path = TL_ABS_PATH . 'logs' . DIR ...

  2. Mathematical operation

    (1)Using let let result=2+1 let result=2-1 let result=2*1 let result=2/1(2) Using bracket echo $(($p ...

  3. c#写入Mysql中文显示乱码 解决方法 z

    mysql字符集utf8,c#写入中文后,全部显示成?,一个汉字对应一个? 解决方法:在数据库连接字符串中增加字符集的说明,Charset=utf8,如 MySQLConnection con = n ...

  4. python基础知识九

    sys模块 sys模块包含系统对应的功能.我们已经学习了sys.argv列表,它包含命令行参数. 命令行参数 例14.1 使用sys.argv #!/usr/bin/python # Filename ...

  5. hibernate--coreapi--configuration sessionfactory--getcurrentsession--opensession

    sessionfactory的目的:产生session,维护数据库连接池 测试文件里的sessionfactory创建数据库连接,所以sessionFactory通过配置文件里的配置信息产生一个数据库 ...

  6. LAMP源码安装,搭建zabbix监控

    #LAMP#httpd-2.2.32#mysql-5.7.17-linux-glibc2.5-x86_64 二进制压缩版#php5.3.27 1.系统环境优化检查 sed -i 's/SELINUX= ...

  7. Android TagFlowLayout完全解析 一款针对Tag的布局

    转载请标明出处: http://blog.csdn.net/lmj623565791/article/details/48393217: 本文出自:[张鸿洋的博客] 一.概述 本文之前,先提一下关于上 ...

  8. 浅谈压缩感知(十九):MP、OMP与施密特正交化

    关于MP.OMP的相关算法与收敛证明,可以参考:http://www.cnblogs.com/AndyJee/p/5047174.html,这里仅简单陈述算法流程及二者的不同之处. 主要内容: MP的 ...

  9. oracle 与其他数据库如mysql的区别

    想明白一个问题:(1)oracle是以数据库为中心,一个数据库就是一个域(可以看作是一个文件夹的概念),一个数据库可以有多个用户,创建用户是在登陆数据库之后进行的,但是有表空间的概念(2)而mysql ...

  10. Python画图代码

    X1D=np.linspace(-4, 4, 9).reshape(-1,1) X2D=np.c_[X1D, X1D**2] y = np.array([0, 0, 1, 1, 1, 1, 1, 0, ...