Tuesday, November 18, 2008

SCP + SSH: Copying files from Windows to Linux

At the university I attend, it is mostly all about Windows and there is no support for linux so many things have to be done by the user to get anything done. However, most linux users are used to trying this on your own. Here I will show you how to successfully transfer files from your linux box at home to a windows computer at work/school. Linux commands refer to Ubuntu. Please see your distro's guide on installing packages.

Software Required:
Windows: Cygwin
Linux: openssh

Configuring linux box:
To install openssh, in terminal type
sudo apt-get install openssh-server
If the linux box is behind a router, please open the port corresponding to ssh. Default is 22. For more information please visit portforward.com.

To test the installation of ssh type:
ssh localhost
If everything works, then that should be up for setting up the linux box.

Configuring Windows:
After downloading setup.exe from the link above, double click to run. The important part of the installation is "Selecting Packages" diaglog box.
Expand the Net tree by pressing the +. Scroll down and look for openssh and click on "Skip" to change it to "Install". You will notice a check box under column B. Click Next when finished and complete the installation.

Operating the Windows Box:
After installation, open cygwin and a terminal will appear. The syntax for scp is:
scp [options] [[user@]host1:]filename1 ... [[user@]host2:]filename2

To copy 'report.pdf' from your Fall 2008 folder on your home directory, you would type:
scp report.pdf user@serverip:"/home/user/Fall 2008/" .
This will save report.pfg into your home directory. Notice the "."

More Information:

Good Luck.

No comments:

Post a Comment

Sociable