Tunneling/SSH?

Associate
Joined
4 Nov 2002
Posts
121
Hi,

I've been trying for hours reading lots of rubbish to try and do something v. simple... I've been using an SSH client to connect to a server, once connected I call SSH/SFTP again to connect to another computer on the network... what I want to do is try to download from the last computer to my computer... but of course the get in sftp and cl in SSH will only download to the intially connected computer... I'm guessing I have to do some form of tunneling but for the life of me I can comprehend it...

Thanks in advance,
Dougie
 
Try something like this:

ssh -C -g -L localport:lastcomputer:22 publicserver

localport is arbitrary, replace lastcomputer and publicserver with their respective IP addresses.

you can then run scp against localhost:localport and it should connect to lastcomputer transparently through publicserver
 
I've got the first one to run:
ssh2 -C -g -L 22:username@2ndserver:22 username@1stserver

This runs fine... now I'm in the prompt for the 1st server... how do I use scp (sorry to sound stupid)...
this is what I was trying to run:
scp 2ndserver:/folder1/folder2/file.ext username2@localhost:localport

which is obviously wrong but I'm not sure what to put there.

Thanks again,
Dougie
 
Assuming you're logged in on server 1 and you want to scp /home/username/file.txt from server 2 to the current working directory on server 1.
or, if you want to copy the same file but to the home directory of another user (ie, a user different to the one you're logged in as):

then assuming you want the same file to be SCP'd to a directory other than username's home directory:
scp username@server2:/home/username/file.txt username@server1:/path/to/where_the/file_should_go/

You can also rename the file as you SCP it over:
 
dougie,

ssh -C -g -L localport:lastcomputer:22 username1@publicserver
NOTE: lastcomputer does not need a username! you do not logon to lastcomputer, just open up a tunnel to its ssh service through publicserver. NOTE: do not use 22 as your localport, you do not have priveledges on your box to open up such a low port. try 9000.

scp -P localport username2@localhost:/path/to/file/on/lastcomputer /path/on/local/computer

This stuff is conceptially quite wierd. You access the tunnel to the lastcomputer by accessing the port you've created on localhost. burbleflop, i think your missing what dougie is trying to do. he wants to create a secure tunnel through a public server to another computer.
 
Back
Top Bottom