Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Mac Os Lion and have the following ssh config file:

$ cat /Users/fernando/.ssh/config
Port 123

This should result in ssh connecting always on port 123, no?

Well, what happens is that it still tries to connect on 22:

$ ssh -v
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/fernando/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to [] port 22.

Any ideas of why this config is not applied? Is ssh config file cached?

share|improve this question
up vote 7 down vote accepted

What happens if you add a Host directive to that config file?

Host *
  Port 123
share|improve this answer
Indeed, larsks. "Port 123" is not a valid .ssh/config. From ssh_config man page: "The configuration files contain sections separated by ``Host'' specifications, and that section is only applied for hosts that match one of the patterns given in the specification." – Alex Holst Oct 19 '11 at 20:22

Try changing ~/.ssh/config to this and see if it works:

        Port 123
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.