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. BZOJ 3672: [Noi2014]购票( 树链剖分 + 线段树 + 凸包 )

    s弄成前缀和(到根), dp(i) = min(dp(j) + (s(i)-s(j))*p(i)+q(i)). 链的情况大家都会做...就是用栈维护个下凸包, 插入时暴力弹栈, 查询时就在凸包上二分/ ...

  2. curl多线程类。

    <?php /* * Curl 多线程类 * 使用方法: * ======================== $urls = array("http://baidu.com" ...

  3. subline text 3的模版设置

    文件目录在这个地方,然后用St3打开,进行模版修改就行了

  4. 一些CSS命名规则

    一些CSS命名规则 头:header 内容:content/containe 尾:footer 导航:nav 侧栏:sidebar 栏目:column 页面外围控制整体布局宽度:wrapper 左右中 ...

  5. 走进C标准库(1)——assert.h,ctype.h

    默默觉得原来的阅读笔记的名字太土了,改了个名字,叫做走进C标准库. 自己就是菜鸟一只,第一次具体看C标准库,文章参杂了对<the standard C library>的阅读和对源码的一些 ...

  6. MYSQL 用户

    MYSQL 并没有与SQL Server一样的两个级别的主体,它只有user. user 的信息都保存在mysql 数据库的 user 表中:我想也可以用insert 的方式新建用户,只是这种尝试还没 ...

  7. Oracle EBS-SQL (INV-2):库存会计期间.sql

    SELECT STATUS, PERIOD_NAME, PERIOD_NUMBER, PERIOD_YEAR, START_DATE, END_DATE, CLOSE_DATE, REC_TYPE,  ...

  8. 提醒录入BOM更改原因

    应用 Oracle Bill Of   Materiel 层 Level Function 函数名 Funcgtion Name BOM_BOMFDBOM 表单名 Form Name BOMFDBOM ...

  9. 如何在C++中获得完整的类型名称(RTTI的typeid在不同平台下有不同的输出值表达,自建类改进了RTTI丢失的信息)

    Wrote by mutouyun. (http://darkc.at/cxx-get-the-name-of-the-given-type/)   地球人都知道C++里有一个typeid操作符可以用 ...

  10. MBG 相关资源链接

    MyBatis Generator(MBG)相关资源链接 http://mbg.cndocs.tk/quickstart.html http://www.mybatis.tk/ http://git. ...