26
10
I want to have a wildcard in my SSH config to set my default username to a particular value for all hosts on a certain domain. But I also want to have some short names for some particular hosts. I expected something like this to work:
Host *.mydomain.com
User myusername
Host host1
Hostname host1.mydomain.com
With those settings, if I type ssh host1.mydomain.com
it evaluates to myusername@host1.mydomain.com
, but if I type ssh host1
it doesn't apply my User setting and I instead see mylocalusername@host1.mydomain.com
.
Is there a way to have the wildcards match on the final expanded hostname so I can type the short or long form and get the same results?
What if you switch the order, putting the wildcard section second. – esmit – 2014-02-27T22:45:49.700
Have you tried it? I'm pretty sure that just gets you the right username with the domain wrong, if anything. – Mu Mind – 2014-02-28T03:06:00.580
I haven't tried it, that's why I made it a comment answer as something to try, instead of a downvotable answer. – esmit – 2014-03-01T06:28:40.983