CSE2003: System Programming (Spring 2009)


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

March 17, 2009

Jin-Soo Kim
Computer Systems Laboratory
Sungkyunkwan University

Another way to share files between Windows (host OS) and Linux (guest OS running on the VMware Player) is to use Samba. Samba is a free software re-implementation of SMB/CIFS networking protocol which is used to share files and directories among Windows machines.

0. Launch a terminal and be a superuser.

First, you should be a superuser. Please refer to the previous document on setting up the ftp server, and follow the same steps (step 0 and 1) to be a superuser.

1. Install samba.

Use the following command to install the samba package on your Linux system.

root@desktop:~# apt-get install samba

2. Make a directory to be shared with Windows.

Click Places->Home Folder in the top menu.

Start a file browser

It will display the file browser on your home directory. Click the right button of your mouse and choose Create Folder in the menu. And make a new directory named share. This will be the directory to be shared with Windows.

Create a directory to share

3. Give sharing options.

Click the icon of the share directory, and press the right button of your mouse. Then, click Sharing Options. Check all the sharing options as shown in the following figure, and then press Create Share button. You will be asked if it is ok for the directory to have write permission by others. Just click Add the permissions automatically. (Note that this is not a safe way of sharing a directory as anybody can read or write the directory. For more secure sharing, you need to create a new user account in Linux whose id matches the one used in Windows.) Now your /home/user/share/ directory is ready to be shared with Windows.

Give sharing options

4. Find your IP address.

Find the IP address of your Linux machine using the ifconfig command (cf. step 4 in the previous document). Here, we assume that the Linux machine's IP address is 192.168.11.132.

5. Access the share directory in Windows.

In Windows, open a new Internet Explorer and type \\192.168.11.132\ as follows.

Accessing the share directory

Then, you will be able to see the directory named share as shown in this figure.

Accessing the share directory

Now if you put something on the share directory, it can be accessed both in Windows and in Linux.