Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

bash

sh

scp

ssh

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?

like image 557
hax0r_n_code Avatar asked Apr 11 '13 12:04

hax0r_n_code


1 Answers

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?

like image 197
Adrian Frühwirth Avatar answered Oct 12 '22 00:10

Adrian Frühwirth