Breaking Systems For Fun And Profit

Random Exit

Create this file as /etc/profile.d/randomexit.sh:

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 the exit` command will close the shell.

TL;DR

  • Long lasting shell sessions
  • Productivity
  • Fun