You can also use the:
Code:
Code:
if [ -n "$SSH_CONNECTION" ]; then export TMOUT=300; fi
Logout ssh user automatically after specified time
This will check if a user is logged in using ssh and will log out the user automatically after the specified time in seconds without data retrieval on the server side.
Will work with bash and zsh so put it into your sourced shell file on the server side.
Be aware that users can change this themselves as it's just a envoronment variable.
From :
http://www.commandlinefu.com/command...specified-time
Recent comments
3 hours 30 min ago
8 hours 22 min ago
17 hours 14 min ago
18 hours 14 min ago
22 hours 1 min ago
23 hours 15 min ago
1 day 2 hours ago
1 day 10 hours ago
1 day 19 hours ago
1 day 20 hours ago