To give my server a bit of personality I have it render words of wisdom everytime I log on to it through SSH. Also, show its uptime and any tunning tmux sessions.

This is for Debian 8, I’m not sure about Red Hat or other distros.

First install fortune and cowsay:

# aptitude install fortune cowsay

Place the following commands in ~/.ssh/rc:

fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n 1)
echo "$(uptime)"
echo ""

tmux list-sessions >/dev/null 2>&1
if [ "$?" = "0" ] ; then
  echo "Running tmux sessions:"
  echo "$(tmux list-sessions)"
  echo "No running tmux sessions."

echo ""

Restart ssh (this will not disconnect any running ssh sessions):

# service ssh restart

Let’s see what happens…