# ssh per-hostname client configuration



## nekoexmachina (Dec 9, 2010)

Hello, forums!
So, the (theoretical) situation is:
there is X hosts with one external IP.
On all of them there is ssh running on different ports.
That ports are all forwarded to the matching hosts.
Any way to configure ssh client on some other unix machine to change ssh port settings with the dependence on hostname?
E.g. on some_machine i do:
ssh first.hostname.org to login to first server
ssh second.hostname.org to login to second server
while all of them have same IPs and different ports.
Any way except for selfwritten wrapper script is appreciated.


----------



## kpa (Dec 10, 2010)

Create a file ~/.ssh/config on the client machine with:


```
Host first.hostname.org
   port port1

Host second.hostname.org
  port port2
```


----------



## nekoexmachina (Dec 11, 2010)

Whoops. I'm embarrased. Sorry for the question.
[closed]


----------

