I call this "mssh" (Matt's ssh).
It should remember that if I type:
mssh 10.2.1.1I really mean
ssh msergeant@10.2.1.1. But if I try
mssh 10.2.2.2it should remember I wanted
ssh msergeant@10.2.2.2.
That way you won't have to worry about the nightmare of dealing with forking, IO transfer, terminals, and
Host mail.optiron.com
User wintercm
And then I can just do 'ssh mail.optiron.com' and it adds the '-l wintercm' in there for me. You can have as many of these 'Host' declarations as you want.
Re:ssh config?
da on 2004-01-23T16:46:02
This also works with arbitrary hostnames, so if you hate typing 'ssh 10.253.189.42' you can shorten it to 'ssh work' in.ssh/config via: This also works with ports, X11Forwards, etc.Host work
User blah
HostName 10.253.189.42
...There's more info in 'man ssh_config' and <plug>I wrote an article for LJ on it too.</plug>
Re:ssh config?
jmason on 2004-01-23T18:45:50
Perfect!
BTW Matt you used the same username twice AFAICS;) Re:ssh config?
lachoy on 2004-01-23T21:52:00
That's a really useful article -- thanks for the pointer!Re:ssh config?
Dom2 on 2004-01-24T19:01:56
The trouble with shortening hostnames is that you still have to type the whole hostname. It's much easier if you can just complete the whole hostname as a command. So, here's a little snippet from my.zshrc (although there's nothing specific to zsh in it, and it should work fine in bash). if [ -f ~/.ssh/known_hosts ] ; then
while read host junk
do
host=${host%%,*}
alias "${host}=ssh ${host}"
done < ~/.ssh/known_hosts
fiAfter putting this in place, all you have to do is ssh to a box once and then start a new shell. You then get completion of the hostname as a command to ssh to that hostname. Dead handy!
-Dom