How to logout sshd after x hour idle

Discussion in 'Server Operation' started by robertlouwen, Apr 16, 2010.

  1. robertlouwen

    robertlouwen New Member

    Hello all,

    At this moment I login to sshd with putty and stay logged in forever. Example: I log in at 23:00 and go to bed, the next morning ( after 8 hours inactivity ) I am still logged in.

    I want to change this behaviour ! After, for example, 1 hour inactivity you get logged out.

    How do I do this ?
    Last edited: Apr 16, 2010
  2. BorderAmigos

    BorderAmigos New Member

    Try setting the environment variable TMOUT=3600.
  3. robertlouwen

    robertlouwen New Member

    Hello BorderAmigos

    In my sshd.config is no TMOUT variable, can I just add it ?
    and 3600 is in seconds, isnt it ?

    Have a good weekend
  4. BorderAmigos

    BorderAmigos New Member

    No, not in sshd.config. It's an environment variable. Try putting this in /etc/rc.local or /etc/profile

    export TMOUT=3600

    Yes it's in seconds. Googld TMOUT for more info. I haven't actually done this so don't guarantee 100% it will work for you.


    ClientAliveInterval 3600
    ClientAliveCountMax 0

    in /etc/ssh/sshd_config.
    Last edited: Apr 17, 2010

Share This Page