The bash shell provides an environmet variable that allows you to control the maximum number of seconds it will wait to automatically logout.
For example try to set the TMOUT environment variable to an integer value and login to your system. Once you are logged in, bash will wait for input the time specified by this environment variable. If the time is exceeded, the shell exits.