Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh/config: line 1: Bad configuration option: include

Tags:

ssh

openssh

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

like image 996
Volatil3 Avatar asked Apr 12 '17 13:04

Volatil3


People also ask

What's the difference between Ssh_config and Sshd_config?

sshd_config is the configuration file for the OpenSSH server. ssh_config is the configuration file for the OpenSSH client.

How do I get to SSH config?

The ssh program on a host receives its configuration from either the command line or from configuration files ~/. ssh/config and /etc/ssh/ssh_config .

What is AddKeysToAgent?

AddKeysToAgent. Specifies whether keys should be automatically added to a running ssh-agent(1). If this option is set to yes and a key is loaded from a file, the key and its passphrase are added to the agent with the default lifetime, as if by ssh-add(1).


2 Answers

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...

like image 97
Attie Avatar answered Sep 28 '22 13:09

Attie


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.

like image 43
mehov Avatar answered Sep 28 '22 13:09

mehov