File Transfer to Linux Machines Using Tunneling

Version 1.01

In the new 2-step login procedure through math1 and math2, the most convenient way to transfer files is through a process known as ssh tunneling. Below are directions. This looks complicated but really isn't too bad after you've done it once. If you run into a problem, please ask for help.

Linux and Mac OS X Case

To do file transfer between
a linux or Mac OS X machine at home (e.g. home.rr.com)
or
a Mac OS X machine in the Department (e.g. mac.math.cornell.edu)
and
an internal linux machine sg9
via
gateway host math1:

On the machine home.rr.com:

Open two shell or terminal windows.
ssh -L2200:sg9.math.cornell.edu:22 username@math1.math.cornell.edu in one window.
This asks the ssh server on math1 to open via math1 a TCP connection between port 22 on sg9 and port 2200 on home.rr.com.
Here username is your Math Department username. Together with the @ sign, it can be omitted if you have the same username on home.rr.com.
Respond with your password on the gateway machine. (Pink Sheet)
sftp -oPort=2200 username@localhost in the second window.
Here we mean exactly the word localhost, but username is still your Math Department username.
Respond with your usual password (Blue Sheet), and do sftp as usual.
Quit sftp before quitting ssh when you are done
because sftp is "tunneling" through the ssh.
You can use netstat -an on home.rr.com to check which sockets (like 2200) are active.

If you are new to sftp, then the most useful commands are help, get, put, ls, lls, cd, lcd, pwd, and lpwd.

Windows Case

To do file transfer between
a Windows machine at home (e.g. home.rr.com)
or
a Windows machine in the Department (e.g. windows.math.cornell.edu)
and
an internal linux machine sg9
via
gateway host math1:

On the machine home.rr.com:

Start putty. In this putty session (which may be saved):
As usual, specify Host Name math1.math.cornell.edu and click on the ssh button changing to Port 22.
If necessary, on the left side of the putty configuration window,
click on the Category connection to lists its subcategories.
Then click on ssh.
For added safety, select SSH protocol version 2 instead of the default 1.
You may have to click on ssh again to list the subcategories below on the left side of the putty configuration window.
Click on tunnels and specify a Source Port of 2200 and a Destination of sg9.math.cornell.edu:22
Click on Add.
Click on Session, give the session a name (under Saved Sessions) and save it before launching by clicking on open.
Respond with your password on the gateway machine. (Pink Sheet)
You can ignore the resultant math1 window but leave it running so that the tunnel will remain active.
Now launch WinScp3.
Program available from http://winscp.sourceforge.net/eng. The application alone will likely be enough. The older WinScp2 may also work.
Under Session specify:
localhost as Host name
Here we mean exactly the word localhost.
2200 as Port
your usual username and password (Blue Sheet)
Click on Stored session and save under some name before you launch this.
Operate WinScp3 as usual to transfer between home and sg9.
Function key F5 is used to actually copy a selected file or directory to the other side of the connection.
When done, exit WinScp3 before exiting putty.

Last Update: December 19, 2003