Ssh: leave channel open for fast copies

scpssh

I have a high latency connection to a remote system. I'm debugging a script on the remote system, and thus repeatedly copying a small file via scp.

This is annoying because it has to re-authenticate (using pubkey) each time and the whole process takes longer than it should.

Is there a port forward or something I can set up would make the copy bypass authentication? Is there a recipe for this?

Best Answer

You could enable connection sharing. You would keep a single connection open (e.g. use it for work on the remote site) and use that same connection to copy with scp.

To activate it you need in your ~/.ssh/config

Host *
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p

ControlPath is the path to the socket for the shared connection. Above example creates a dynamic name from login and hostname.

Related Question