LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Openssh timeout (https://www.linuxquestions.org/questions/linux-software-2/openssh-timeout-373039/)

wwnexc 10-14-2005 10:42 AM

Openssh timeout
 
I was wondering how to set a timeout for openssh. I know that under other programs you could set max time for users to be logged on,l before they are disconnected and forced to reconnect.

How would i set such a timeout in openssh?

thanks

MensaWater 10-14-2005 11:53 AM

Actually you set this in the shell (bash, sh, csh, ksh) rather than ssh itself. For bash, sh & ksh adding a variable to /etc/profile will do this. You sepcify the TMOUT parameter with a number of seconds.

Example:

TMOUT=1800;export TMOUT

Would log the user out automatically after 1800 seconds (30 minutes).

There is also a similar variable in csh but that get set in /etc/login. If you're doing csh read the man page to get the exact variable there.

NOTE: The above TMOUT works due to perceivd inactivity in the shell. If a user types "vi somefile" and never exits the vi the shell won't recognize that as inactivity as it has no way of knowing whether the user is just sitting there or actively editing something. That means it is a good tool for just keeping users from staying logged in without ever doing anything but there are ways for users to fake it out. Also of course smart users can simply type "unset TMOUT" after login to disable it. You just have to hope that anyone not smart enough to not leave a terminal logged in forever also wouldn't be smart enough to figure this out.

wwnexc 10-14-2005 05:44 PM

Thanks for your detailed solution, jlightner, but i actually meant a timer wich after a certain time of being logged on, independent of activity or idleness, disconnects the user after a set ammount of time.

Is there any way to do this?

wwnexc 10-15-2005 12:21 AM

Any ideas??


All times are GMT -5. The time now is 01:38 AM.