24

According to my ssh_config file...

Configuration data is parsed as follows:

  1. command line options
  2. user-specific file
  3. system-wide file

With that said, (and yes, I know, I could scour man ssh_config AND man ssh, and (hope) for documented defaults).. how can I "print out" the active configuration, for ALL current settings. For example, something like...

ssh -o Tunnel=ethernet servername -p 2210 --print-config

SSH-2.0-OpenSSH_7.0
 Command Line Options
   Port 2210
   Host servername
 Command Line Configurations
   Tunnel Ethernet
 Config File
   ...
 SSH Defaults
   ...
   AddressFamily any (???)
   BatchMode no
   ...

This would let you know explicitly exactly what is set, and why. I called out AddressFamily specifically, as it is a perfect example of a configuration option with NO documented default value. From man ssh_config...

Specifies which address family to use when connecting. Valid arguments are any, inet (use IPv4 only), or inet6 (use IPv6 only).

Ugh! Thanks for any constructive suggestions (not just a bunch of RTFM's). 🙉

4
  • refer to this post. sshd uses the config files to override its internal defaults, that are shown in the stock config files after fresh install – gwillie Aug 27 '15 at 3:13
  • 1
    @gwillie Note: ssh_config != sshd_config. – EEAA Aug 27 '15 at 3:14
  • what does it matter, there's no way to do it, I wrote a script when I had to do it, just make sure you parse the files in the right order – gwillie Aug 27 '15 at 3:19
  • On Mac OS X, only a small subset of the many available options are mentioned in the "stock" config files, unfortunately. – mralexgray Aug 27 '15 at 7:36
40

There is -G option in recent openssh, which behaves in similar way as -T on server side.

-G Causes ssh to print its configuration after evaluating Host and Match blocks and exit.

By calling ssh -G host you will get options used for connecting to specific host, which can be helpful for debugging conditional matches in ssh_config.

Also setting more verbose log level (-vvv) can help with debugging config parser.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.