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?
Any
ssh
option that can be used in the form-o Option=Value
can be set in the config file as anOption Value
line. Many of the CLI flags are merely shorthand for long-format options, egssh -2
is equivalent tossh -o Protocol=2
, and can thus be set in.ssh_config
asProtocol 2
.I believe that
-R x:rhost:y
corresponds toRemoteForward 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
andssh_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.-G option will display config options. This script helps to generate a clean entry from ssh command options:
Example use:
I have a gist that will convert your entire ssh shell history.