ssh to get into a specific server on a specific port as normal:
ssh -p <port_number> <server_name>
How do I configure ssh to automatically use the right port number for a specific server, so that I don’t have to enter the
-p <port_number> parameter? Note different servers I connect to will have different port numbers.
Put it in your
$HOME/.ssh/config file. For example:
Host bad.example.com Port 2222 Host * Port 22
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.