SSH Wrapper Script

by Tony Mattke on November 30, 2008



Ok — this is my first script that I’m posting here. Its a VERY simple ssh wrapper script that you can place in your path, preferably in ~/bin

#!/bin/bash
SSH="/usr/bin/ssh"

case "$*" in
 *'@'*)     $SSH $* ;;
 *' -l'*)     $SSH $* ;;
 *)         $SSH -l root $* ;;
 esac

What this allows us to do is ssh as root to another box w/o specifying a user. Very handy if you spend your life in a terminal as I do. This could also be easily modifed for use with SCP or anything you wish…

Who writes this crap?

Tony Mattke is a network engineer for a financial institution in Indiana. In the past he has worked for ISPs, data centers, networking manufactures, and the occasional enterprise. For feedback, please leave a comment on the article in question. For everything else including fan mail or death threats, contact him via twitter.

No related posts.

Leave a Comment

Previous post:

Next post: