SSH Trick

To start off with.. I know you can do this in DNS using a search parameter but I don’t want to do that in my envirnoment.

Sometimes you are working with a hostname that is long due to the domain name. This is the case where I am currently working, the domain is theopenskyproject.com. So I did the following and added into my ~/.bashrc

function ssh() { /usr/bin/ssh $1.theopenskyproject.com; }

You can now do the following

ssh node1
ssh user@node1

Right now its pretty simple. Flags won’t work with ssh. If you want you can make it more shorthand by calling the function s

About mike
Currently works for OpenSky as a Senior Linux Admin. He has a wonderful wife Thanuja and 2 great dogs. His major side project is Photoblog.

Comments

One Response to “SSH Trick”

Trackbacks

Check out what others are saying about this post...
  1. [...] friend of mine just recently posted a trick with long hostnames when using SSH. I have commented before many times when I see people making aliases or [...]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!