3

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?

2
  • AFAIK, you are basically going to need to have the ssh_config and ssh man pages open. Then switch back and forth. – Zoredache Apr 2 '13 at 8:08
  • That's fine, the hard bit is actually finding which ssh_config option to use for a given command line option. – Steve Bennett Apr 2 '13 at 8:26
4

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.

3
  • Ok, so .ssh/config options can be converted to command line parameters with -o. But there isn't a way to convert short-form command line parameters, since SSH doesn't conform to GNU command line parameter conventions (eg, -R, --remote-forward). – Steve Bennett Apr 2 '13 at 7:43
  • Not quite. There is no way to convert any flag options - whether long or short form - to config parameters, excepting those that can be expressed on the CLI not only as flags but also as -o Option=Value. Most flags do have such an alternative expression; any that don't, can't be so converted. – MadHatter Apr 2 '13 at 9:22
  • Yup, cool. I guess it boils down to this: the man page should be clearer about what the alternative expression is, where there is one. – Steve Bennett Apr 2 '13 at 23:41

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.