scp over existing ssh tunnels?

Tom Buskey tom at buskey.name
Mon Jul 30 10:02:42 EDT 2007


On 7/30/07, Paul Lussier <p.lussier at comcast.net> wrote:
>
>
> Hi all,
>
> This *ought* to be something I know how to do, but for some reason
> it's completely escaping me.
>
> I have an existing ssh tunnel between ethics-gradient(eg), my desktop
> at work, and taz, my home server.  There's a file on taz I need to get
> to eg.
>
> I could just scp it directly, but that opens up another connection.
> The goal is to re-use the existing connection.  In my config file, I
> have:
>
> host *
>    ControlMaster yes
>    ControlPath /tmp/%r@%h:%p
>
> This allows me to then do:
>
>   ssh -S /tmp/pll at taz:22 taz.mydomain.org
>
> which is, by the way, superfast, and avoids any re-authentication (and
> since I use OTP for ssh'ing to my home system, it's very nice :)
>
> I *thought* I could use scp in this manner, but -S for ssh is
> different from -S for scp.
>
> Doing something like:
>
> (ssh -S /tmp/pll at pll@taz:22 taz.mydomain.org cat /tmp/foo)  > /tmp/foo
>
> seems kind of silly.



I haven't done anything with OpenSSH's multiple connections stuff.

I've used netcat to do this.
When you SSH in, add -L 31000:127.0.0.1:31000

On the remote:
    nc -lvnp 31000 127.0.0.1 > file

On the local:
    nc -v -w 2 127.0.0.1 31000 < file

No extra overhead.  TCP takes care of error correction.  SSH has already
encrypted the pipe.  You cannot use GNU netcat which some distributions have
started substituting.  It doesn't allow -l and -p (which is a major flaw
IMO).  You need Hobbit's original netcat 1.10.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20070730/7301a7e2/attachment.html 


More information about the gnhlug-discuss mailing list