sshscpssh-multiplexing

Can I use an existing SSH connection and execute SCP over that tunnel without re-authenticating?


I'm wondering if I already have an established SSH tunnel and I want to minimize re-authenticating with an ssh server for each task, is there a way to use an existing tunnel to pull a file from the SSH server using SCP on the local machine without re-authenticating?

I'm trying to avoid using ssh keys, I'd just like to minimize the amount of times a password needs to be entered for a bash script.

ssh -t user@build_server "*creates a build file...*"

Once that command is completed there is a file that exists on build_server. So if the above tunnel was still open, is there way to use that tunnel from my LOCAL machine to run SCP to and bring the file to the local machines desktop?


Solution

  • Yes, session sharing is possible: man ssh_config and search for ControlMaster and/or check here and here. Is this what you are looking for?