19

In my ~/.ssh/config I added the following:

Include /Path/to/ssh.config

And it gives error:

ssh remoteEc-2
/Users/Me/.ssh/config: line 1: Bad configuration option: include
/Users/Me/.ssh/config: terminating, 1 bad configuration options

ssh -V gives:

OpenSSH_6.9p1, LibreSSL 2.1.8

I am on OSX El-Capitan

Volatil3
  • 14,253
  • 38
  • 134
  • 263

2 Answers2

20

Include is not a valid option until version 7.3...

See: https://www.openssh.com/txt/release-7.3

New Features

[...]

  • ssh(1): Add an Include directive for ssh_config(5) files.

Also, see this answer.


If you can't / don't want to update, then you could collate your configuration files, using the following:

cat ${CONFIG_1} ${CONFIG_2} ${CONFIG_3} > ~/.ssh/config

You'd need to run it every time you update any of the parts...

Attie
  • 6,690
  • 2
  • 24
  • 34
  • hm.. so I am using default OSX ssh.. a bit afraid to install and use homebrew version. – Volatil3 Apr 12 '17 at 15:23
  • I've updated my answer to include a method to 'collate' your configuration files... – Attie Apr 12 '17 at 15:26
  • There is only one configuration file that is part of a Github repo. I will update it based on changes. Is `${CONFIG_1}` a variable here? – Volatil3 Apr 12 '17 at 17:36
  • If you only have one config, then you could look at using a symbolic link... either way, be careful of using an SSH config file from a repository, as it would be easy for others to modify it, and for you to miss the changes... yep, `${CONFIG_1}` is standard bash notation for a variable. – Attie Apr 12 '17 at 17:39
9

Same problem, except I'm on 7.4

Turns out, the Include directive needs to go into /etc/ssh/ssh_config, not /etc/ssh/sshd_config (note the d in the filename).

Wasn't obvious to me. Hope this saves whoever finds this some time.

ᴍᴇʜᴏᴠ
  • 4,804
  • 4
  • 44
  • 57
  • 1
    Quick explanation on what's the difference. A Linux computer can act both as an SSH server accepting connections, as well an SSH client making connections. The `d` in `sshd_config` stands for daemon, which runs in the background waiting for external connections. While the regular `ssh_config` controls how your linux machine (even a server) connects to other computers (e.g. Git servers or backup hosts). – ᴍᴇʜᴏᴠ Sep 06 '21 at 10:29