ssh – My Setup

This is the shell script I use as my alias for ssh:

#!/bin/bash
ssh-agent
ssh-add
case $1 in
    marge* ) SSHCOLOR=1 ;;
    bluebones.net ) SSHCOLOR=1 ;;
    barney* ) SSHCOLOR=7 ;;
    lisa* ) SSHCOLOR=6 ;;
    homer* ) SSHCOLOR=3 ;;
    * ) SSHCOLOR=5 ;;
esac
if [ $1 ] ; then
    tput setab $SSHCOLOR
    \ssh $*
    tput setab 9
else
    echo "Usage: $0 [HOST]"
fi

The background colour shows me at a glance which machine I am on.

2 Replies to “ssh – My Setup”

  1. Why the ssh-agent/ssh-add? Surely you’d be better off with the ssh-agent being started before your window manager, so that it’s inherited by all of your terminal windows automatically?

  2. I do ssh-agent/ssh-add everywhere! It’s in my .bashrc (so it persists) and my .gnomerc (so it persists for stuff I start from the Run Application box) too! Perhaps having it in here as well is overkill/pointless.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.