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?
Best Answer
Simply use: