zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Unity周记: 2020.09.07-09.13
    Unity周记: 2020.08.31-09.06
    CF1060F Shrinking Tree
    洛谷P6783 [Ynoi2008] rrusq
    洛谷P5644 [PKUWC2018] 猎人杀
    洛谷P1587 [NOI2016] 循环之美
    洛谷P4466 [国家集训队] 和与积
    集合幂级数杂题
    Flink基础(49):FLINK SQL(25) 内置函数(七)表值函数
    Flink基础(48):FLINK SQL(24) 内置函数(六)条件函数
  • 原文地址:https://www.cnblogs.com/diyunpeng/p/3548979.html
Copyright © 2011-2022 走看看