2

Okay - worst subject ever? Sorry.

$ cat ~/.ssh/config
# Host wut
#   LocalForward 1234 whatever:1234

Include ~/.ssh/test.include

$ cat ~/.ssh/test.include
Host op1
  HostName 123.123.123.123

$ ssh -G op1 | grep hostname
hostname 123.123.123.123
canonicalizehostname false

Looks good, right? sshing to op1 would use 123.123.123.123. Yay. Expected.

Uncomment that "Host wut" block. (It could be any directive here. This particular one is seemingly not special.)

$ cat ~/.ssh/config
Host wut
  LocalForward 1234 whatever:1234

Include ~/.ssh/test.include

$ cat ~/.ssh/test.include
Host op1
  HostName 123.123.123.123

% ssh -G op1 | grep hostname
hostname op1
canonicalizehostname false

Wut? Why? Why you no ssh to 123.123.123.123 anymore?

FWIW, if it matters:

ssh -V
OpenSSH_9.6p1, LibreSSL 3.3.6

1 Answer 1

4

From man 5 ssh_config [emphasis mine]:

Include directive may appear inside a Match or Host block to perform conditional inclusion.

And this is exactly what happens. Your Include is inside the Host wut block; the file will be included if and only if Host wut matches. If you want unconditional inclusion, add Host * just before the Include.

2
  • So indenting has no meaning?
    – jsharpe
    Commented 11 hours ago
  • 1
    @jsharpe Indenting has no meaning. Commented 8 hours ago

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .