Breaking Systems For Fun And Profit

Random Exit

Create this file as /etc/profile.d/

export PROMPT_COMMAND='[ ${SECONDS} -ge $[ ${RANDOM} % 1800 ]] && exit'

What it does

Every time a prompt is shown the system checks if the lifetime of the current shell (${SECONDS}) is greater than or equal to a random number between 0 and 1800. If so, the shell then exits.

Why it works

The contents of the ${PROMPT_COMMAND} variable is evaluated every time a prompt is shown, within the context of the current shell. Running theexit` command will close the shell.