.ssh/config’s uncle

Your ~/.ssh/config file (you’re using one, right?) has inheritance.  Oh yeah.

Say you have a bunch of servers at heroes.com, and you have to proxy to them.  Additionally, assume that you use the same user name on all of them but *one*.  Damn sysadmins.

You don’t have to remember to include the username on the odd one.  Well, remember the 2nd time because you’re first try doesn’t work.

Observe:

What ssh does (apparently), is collapse the options from the top down, for all matching entries. So when you ssh to superman.heroes.com, the connection is setup with the superman user, but using the proxy from the * entry.  

So, basically, any options on top override any on the bottom, but if the option is specified on the top, the one from the bottom is used.

I assume (and you know what happens) that this holds for multiple (more than 2) matching sections, but I have no idea.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s