[Labs-l] SSH to labs instances with less typing

Antoine Musso hashar+wmf at free.fr
Wed Mar 9 20:38:43 UTC 2016


Le 09/03/2016 19:47, Aaron Halfaker a écrit :
> Hey folks,
> 
> I have spent a little time today working out a cute little bash alias
> trick for reducing my typing when connecting to various instances in
> labs.  Adding the following code to your /.bash_alias/ (or just
> /.bashrc/) file will change $ ssh <your instance>.eqiad.wmflabs to $
> labs <your instance>.
> 
> 
>     labs_ssh() {
>       ssh $1.eqiad.wmflabs
>     }
>     alias labs=labs_ssh
> 
> 
> And there you have it.  It's not much, but this helped my sanity a
> little bit and I wanted to share.
> 
> -Aaron

That is a nice one!

Mine is relying on bash_completion to look up potential hostname from
the ssh know host file.  Using <TAB> I can look it up:

 ssh foo<TAB>
 ssh foobar.project.eqiad.wmflabs<RETURN>


OpenSSH hashes the hostnames in the known_host file though so one would
want to disable that feature in ~/.ssh/config

   HashKnownHosts no


Obviously, one might want to install bash_completion and source it from
its ~/.bashrc .

-- 
Antoine "hashar" Musso




More information about the Labs-l mailing list