LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Using scp with ssh tunnel (https://www.linuxquestions.org/questions/linux-software-2/using-scp-with-ssh-tunnel-523313/)

meawoppl 01-27-2007 03:11 PM

Using scp with ssh tunnel
 
Heres the problem:
I have set up a ssh server at my home that listens on the required port. From there, I can ssh into the other Linux machines on the network. This works fine, but I can not figure out how to copy files from my laptop at a coffee shop to one of the Linux machines behind the ssh server.

I have been using scp to move the files I wanted to move on to the ssh server, and then ssh'ing into the server and using the same to copy to the machine on the network.

This is a pain. Is there a way to simply accomplish this? Heck, is there even a difficult way to accomplish this?

Basically I want scp to tunnel through servers to get my data somewhere . . . Any help would be appreciated.

Thanks!

pnellesen 01-27-2007 03:36 PM

I could be wrong about this (I haven't tried it) but I would think that, once you're connected to your home server via SSH in one terminal, you would be able to open another terminal and then use scp to copy directly from the laptop to the server: "scp /laptopDirectory/fileOnLaptop user@yourserver /serverDirectory/fileOnServer" or something similar... (check "man scp" for details ;) )

acid_kewpie 01-27-2007 03:37 PM

well you wouldn't use ssh *and* scp together, as they are the same thing inside....

ok. start again....

you use ssh to get into your lan and then want to copy files across that conenction and directly into another machine in your private network? ok that's fine... as part of your ssh connection, add a tunnel, e.g. -L 1234:othermachinesip:22 and log in. then you can launch scp to connect to 127.0.0.1:1234. connecting to that will actually connect to othermachinesip:22 i.e. ssh/scp/sftp on the "unreachable" machine. that what you mean?

meawoppl 01-27-2007 04:04 PM

Thanks!
 
That is a great solution. I was confused at first about the syntax, but basically the -L switch will reroute after the first connection to the next sub-connection and redirect everything just right. Thanks!


All times are GMT -5. The time now is 09:22 PM.