I.T. Security and Linux Administration

Jul 4 2010   2:09PM GMT

.bashrc, meet SSH…aka: recovery-godsend

Eric Hansen Eric Hansen Profile: Eric Hansen

I have SSH access for both my home network, and my work.  The idea to implement this came from the fact my work actually does this already.  Instead of typing ssh <commands> you just type na <hostname/ip> and it’ll do the dirty work for you.  At first, I thought the “na” command was either a script or custom program, but it turns out it’s just an alias set in .bashrc.  Below is my version (modified to my own liking):

function ssh_call() {
case "$1" in
ssh noone@myhome
ssh work@domains
echo "Only home & work are possible arguments. One or the other must be passed."

alias sh=’ssh_call home’
alias sw=’ssh_call work’

I’m sure there’s better ways and stuff of doing this, but it works for me, hehe. All in all, bash scripting can be quite useful when used correctly.

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: