I want to scp files from my local machine to a remote machine that needs a JumpHost - via ProxyCommand - and a RemoteCommand on the remote machine to become another user. To ssh to the remote machine i use the command
ssh abremote
and those are the configs i use in my .ssh/config:
Host abremote*
Hostname abremote.domain
ProxyCommand ssh -q -W abremote.domain:port ab-hop
RequestTTY no
Host abremote
RemoteCommand sudo -u user123remote -i
Host ab-hop
User user123me
Hostname ab-hop.domain
ServerAliveInterval 120
IdentitiesOnly=yes
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
Using the ssh config entry like this:
scp file.txt abremote:/folder_1/folder_2/
it does not work. To use the ProxyCommand in the scp is not the problem, but is it possible to also execute the remoteCommand from a scp call?