Ssh – Convert ssh command line arguments to .ssh/config properties

ssh

I understand that (almost?) all SSH command line arguments can be replaced with a property in ~/.ssh/config. But it's not at all obvious how to do this systematically: the man page for ssh only refers loosely to the config page (eg, "Port forwardings can also be specified in the configuration file."). The man page for ssh_config never refers to command line options.

So, is there a definitive list of the corresponding config parameters and command line options? For example, what does -R correspond to?

Best Answer

Any ssh option that can be used in the form -o Option=Value can be set in the config file as an Option Value line. Many of the CLI flags are merely shorthand for long-format options, eg ssh -2 is equivalent to ssh -o Protocol=2, and can thus be set in .ssh_config as Protocol 2.

I believe that -R x:rhost:y corresponds to RemoteForward x rhost:y.

But I don't think there's any way to specify a flag that doesn't have a corresponding long-format form. And on my system the definitive list appears both in the ssh and ssh_config man pages, in the former under the -o flag, and in the latter in the main body of the page, starting very near the top.