CSE2003: System Programming (Spring 2009)


Sharing files between Windows (host) and Linux (guest) using FTP

March 17, 2009

Jin-Soo Kim
Computer Systems Laboratory
Sungkyunkwan University

This page presents how you can move files between Windows (host OS) and Linux (guest OS running on the VMware Player) using the famous file transfer protocol (FTP).

0. Launch a terminal.

The terminal program in Linux is similar to the cmd program in Windows. Basically, this is the old-fashioned command line tool with which you can do whatever you want. You can launch a new terminal by choosing Applications->Accessories->Terminal in the top menu of the screen as shown in the following figure.

Launch Terminal

This is how the terminal window looks like. In most cases, you will want to run multiple terminal programs.

Terminal

1. Be a superuser (root).

To install something, you should be an administrator of the system. The account "user" you are currently using is a normal user account which has restricted privilege. The administrator of Linux or Unix systems is called superuser or root. In Ubuntu, you can not explicitly log in to the root account. Instead, you need to use the sudo command as follows. If successful, you can see the "#" sign at the end of your command prompt. This designates that you are currently in superuser mode. To quit from the superuser mode, type exit in the command line.

user@desktop:~$ sudo -i
[sudo] password for user: user
root@desktop:~#

2. Install ftpd and inetd.

The next step is to install ftpd and inetd as these programs are not installed by default on your Linux image. ftpd is an ftp server and inetd is a super-server daemon that manages various Internet services including ftp. These programs can be installed by the following command:

root@desktop:~# apt-get install ftpd

The following figure shows what happens when you type the command. Just say Y when the system asks you if you are ready to install the program.

Install ftpd and inetd

3. Start inetd.

You should activate inetd daemon in order to get ftp service. The inetd daemon can be started with the following command:

root@desktop:~# /etc/init.d/openbsd-inetd start

You can test whether the ftp server works fine or not by issuing the following command:

root@desktop:~# ftp localhost

This command let you connect to your own server (The localhost is a reserved hostname which indicates the current machine.). If everthing is fine, you will get the login prompt which is required to log in to your server by the ftp client. Use the default account (username="user", password="user"). You will be able to see the following greeting messages sent from the ftp server.

Start inetd and check ftp

4. Find your IP address.

In order to connect to your Linux machine from the Windows host, you need to find the IP address which is assigned to the Linux machine. The VMware Player automatically assigns an IP address when it boots up. The IP address can be found by the "ifconfig" command:

root@desktop:~# ifconfig

This ifconfig command prints out all the information related to network interfaces attached to your system. Normally, you will have at least two network interfaces; one (ethX) is the virtual Ethernet interface created by the VMware Player, and the other (lo) is the local loopback interface provided by the system. The ethX interface is used to connect to this machine from other external hosts. So, look for the "inet addr:" entry for ethX. The following figure shows an example output. In this case, the network interface is eth2 and the IP address is 192.168.11.132. Note that the actual values of X in ethX and the IP address can be different from machine to machine depending on network configurations.

Get your IP address

5. Connect to your Linux using ftp.

Windows has its own ftp client program by default. First, run the C:\Windows\system32\cmd.exe program. This will open a new command window. In the prompt, type ftp 192.168.11.132. You should specify the exactly same IP address obtained from the previous step. If there is no problem, you will get the login prompt. Once you are logged in with the default account (username="user", password="user"), you will be able to exchange files between the Windows host and the Linux machine using the conventional ftp commands.

Check ftp from Windows

6. Using Windows-based ftp client.

If you are not familar with the command line version of the ftp client, you can use other Windows-based ftp client programs such as FileZilla. The FileZilla program is a free ftp client available from http://filezilla-project.org. With FileZilla, you don't have to type get or put command by yourself. Just drag and drop whatever files you want.

The following figure shows how to setup your FileZilla to connect to your Linux machine. Remember you need to specify your own IP address obtained from step 4.

Setting up FileZilla

Once connected, you can easily move files to and from the Linux machine. Enjoy!

Using FileZilla