Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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've tried setting up my ~/.ssh/config file with the help of this guide. However, the host-specific User override has no effect and ssh tries to connect using the global username instead of the host-specific one. My ssh config is set up like this:

$ cat ~/.ssh/config
User my_global_username

Host dev1
    User my_username_on_dev_machines

I've also tried putting the global user name below a Host * entry to no avail. The OpenSSH version and build I'm running is OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013 `.

share|improve this question
up vote 8 down vote accepted

There is no "global" value in .ssh/config. If you want to have a default value you have to put it in a "Host *" section:

Host dev1
    User my_username_on_dev_machines

Host *
    User my_global_username

Note the ordering: The first match wins!

share|improve this answer
A couple of follow-up questions:1) Has the behavior changed recently? The guide at the linked website clearly shows Host * in the top. – andyn Feb 18 '14 at 12:04
2) The first match wins, but apparently only for those values it explicitly sets. Is this documented somewhere? Man ssh_config does not show anything related in Host or PATTERNS sections. – andyn Feb 18 '14 at 12:14
First sentence in the second paragraph in ssh_config(5) says: "For each parameter, the first obtained value will be used." I don't know if that changed recently, but I had "Host *" at the bottom all the time. – cran Feb 18 '14 at 13:04

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.