Skip to main content
Took Giles' idea but expanded it out to make it clearer
Source Link
Stephen Harris
  • 49.7k
  • 7
  • 115
  • 139

You can wildcard and use %h in your config

eg

Host *.eng
  Hostname %h.domainname.com

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com.

You can add other options to this config as well; eg forcing the username

Host *.eng
  Hostname %h.domainname.com
  User me

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com as the user me.

% ssh foo.eng
ssh: Could not resolve hostname foo.eng.domainname.com: Name or service not known

(well, obviously I get an error before it's not a valid hostname for me!)

So now you only need one rule per country.

You can wildcard and use %h in your config

eg

Host *.eng
  Hostname %h.domainname.com
  User me

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com as the user me.

% ssh foo.eng
ssh: Could not resolve hostname foo.eng.domainname.com: Name or service not known

(well, obviously I get an error before it's not a valid hostname for me!)

So now you only need one rule per country.

You can wildcard and use %h in your config

eg

Host *.eng
  Hostname %h.domainname.com

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com.

You can add other options to this config as well; eg forcing the username

Host *.eng
  Hostname %h.domainname.com
  User me

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com as the user me.

% ssh foo.eng
ssh: Could not resolve hostname foo.eng.domainname.com: Name or service not known

(well, obviously I get an error before it's not a valid hostname for me!)

So now you only need one rule per country.

no need to keep typing the me@ part either
Source Link
Gilles 'SO- stop being evil'
  • 866.1k
  • 205
  • 1.8k
  • 2.3k

You can wildcard and use %h in your config

eg

Host *.eng
  Hostname %h.domainname.com
  User me

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com as the user me.

% ssh foo.eng
ssh: Could not resolve hostname foo.eng.domainname.com: Name or service not known

(well, obviously I get an error before it's not a valid hostname for me!)

So now you only need one rule per country.

You can wildcard and use %h in your config

eg

Host *.eng
  Hostname %h.domainname.com

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com.

% ssh foo.eng
ssh: Could not resolve hostname foo.eng.domainname.com: Name or service not known

(well, obviously I get an error before it's not a valid hostname for me!)

So now you only need one rule per country.

You can wildcard and use %h in your config

eg

Host *.eng
  Hostname %h.domainname.com
  User me

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com as the user me.

% ssh foo.eng
ssh: Could not resolve hostname foo.eng.domainname.com: Name or service not known

(well, obviously I get an error before it's not a valid hostname for me!)

So now you only need one rule per country.

Source Link
Stephen Harris
  • 49.7k
  • 7
  • 115
  • 139

You can wildcard and use %h in your config

eg

Host *.eng
  Hostname %h.domainname.com

Now when you do ssh foo.eng it will try to connect to foo.eng.domainname.com.

% ssh foo.eng
ssh: Could not resolve hostname foo.eng.domainname.com: Name or service not known

(well, obviously I get an error before it's not a valid hostname for me!)

So now you only need one rule per country.