Skip to main content

session_command_args

Function session_command_args 

Source
pub fn session_command_args(
    program: &str,
    args: &[String],
    ssh: &SshTarget,
    lease: &SshSessionLease,
) -> Vec<String>
Expand description

The argument list for program (ssh or scp) running as one session on lease’s master: the session options first, then the command’s own arguments.

OpenSSH keeps the first value it sees for an option, so leading with the session options makes them win over the user’s ssh_args and ssh_config, including any ProxyCommand or ProxyJump. ssh refuses the -J flag after a ProxyCommand outright, so a -J in the user’s own arguments is rewritten to the equivalent -o ProxyJump=, which the session’s ProxyCommand=false then overrides; a session never connects by itself, and the master was opened with the user’s jump host. scp already passes its -J on as -oProxyJump=.