Bug 3437 - implement ssh’s -G for sftp and scp
Summary: implement ssh’s -G for sftp and scp
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Miscellaneous (show other bugs)
Version: 9.0p1
Hardware: Other Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-21 07:37 AEST by Christoph Anton Mitterer
Modified: 2022-05-24 07:45 AEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Anton Mitterer 2022-05-21 07:37:27 AEST
Hey.

My understanding is that ssh’s -G option acts like a --dry-run (in the sense that it can be used jointly with any other valid options to ssh) + printing out the settings.

As mentioned in #3436, this makes -G great for other programs to parse ssh_config without having to deal with any format changes/extensions there or with going through the Host/Match blocks.

It would be nice if the same option was added to sftp and scp.

Assuming one has an arbitrary sftp/scp command line (that one wants to have parsed, with options from ssh_config), one cannot simply replace sftp/scp with ssh, where -G already exists, because sftp/scp have several options and other arguments that don't work with ssh.

So one would need to implement some command line parsing to adapt to that and use ssh instead.

Much simpler would be if sftp/scp had the same options.

Thanks,
Chris.
Comment 1 Christoph Anton Mitterer 2022-05-24 07:45:59 AEST
Having thought a bit more about this, at least for scp one would probably need a new output format, so that one can read the settings for remote source *and* destination connections.

Perhaps one could simply prefix each line with "src:" / "dst:" or something like that (ideally using a separator char, that won't ever show up in plain option names.

Similarly,... it might be interesting for consumers of -G output, to learn about any further hops (ProxyJump and so)... so perhaps the settings of these could also be printed with another prefix, e.g. a number n indicating that these are the settings for the nth hop.