Purpose: This post will explain how you can mount a Linux filesystem (ext2/etx3) on your Windows XP machine over a network.

Note: If you are looking for how to the reverse – Mount a windows share drive on a linux machine over a network then please refer to my previous blog entry.

Also this blog entry does NOT explain how you can access an ext2/ext3 filesystem on your Windows XP partition on the same hard drive – The typical Dual Boot scenario. Update (12/22/2008): To see how to do this, see this.

Important Note: Before you read any further I strongly encourage you to do the things that I mentioned in my previous blog as noted above. Your chances of success to follow the instructions on this entry will greatly increase. Therefore I strong encourage you to do all the things mentioned in my previous blog.

My Setup:

1. Debian Linux (4.0) running 2.6.24 kernel with IP address 192.168.0.2 and user accounts: “root” and “kushalk”

2. Windows XP SP2 machine on a network domain called “home.net” with IP address 192.168.0.3 and user account: “kkoolwal”

Step 1: Install Samba Package on your Linux machine

#apt-get install samba

Step 2: Stop the Samba Daemon

It is a good idea to stop the Samba daemon since we will be making changes to the Samba configuration file.
#/etc/init.d/samba stop

Step 3: Edit the Samba file /etc/samba/smb.conf (may be required)

This will require two steps:

a) Make sure that your domain/workgroup name is setup correctly in the variable “workgroup”. Also you need to un-comment the line by removing the “;” or “#” symbol.
workgroup = home.net

Make sure you set the name of your workgroup properly. To find out the name of your workgroup/domain do the following on your Windows machine.

To find out the Workgroup name in Windows follow these steps:
– Go to “START”
– Click “Control Panel”
– Click “System”
– Click on the 2nd tab button named: “Computername” and find out the name of your workgroup/domain.

b) Select which directory you want to share

As per the default setting you will be able to access your home directory on your Windows XP machine i.e. the directory of the user from which you connect. If you want to access any other directory other than your home directory then you need to add the following section anywhere in the smb.conf file:
[src]
comment = My Kernel/Module development sources
path = /usr/src/
read only = Yes

Basically by doing the above you are telling your Samba server that you want to share the ‘/usr/src’ directory.

That’s it. Your smb.conf file should now be configured.

Note: It is a good idea to check your smb.conf file for any syntactic error by giving the following command:
# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = home.net
server string = %h server
obey pam restrictions = Yes
passdb backend = tdbsam
passwd program = /usr/bin/passwd %u
passwd chat = *EntersnewsUNIXspassword:* %nn *RetypesnewsUNIXspassword:* %nn *passwordsupdatedssuccessfully* .
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
wins server = eth0:192.168.0.20
panic action = /usr/share/samba/panic-action %d
invalid users = root
include = /etc/samba/dhcp.conf
[homes]
comment = Home Directories
valid users = %S
create mask = 0700
directory mask = 0700
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
#

Step 4: Add a user to the Samba user list

You need to tell the Samba server which user you will be using to connect the to Linux filesystem from the Windows machine. I added myself (user: kushalk) to the Samba server by giving the following commands:
smbpasswd -L -a kushalk
smbpasswd -L -e kushalk

Note: By default, Samba does not allow the user “root” to access the filesystem. You will have to change the setting “invalid users = root” in your smb.conf file. I have not tried this.

Step 5: Restart the Samba server
#/etc/init.d/samba start

Step 6: Access your Linux filesystem/folder from Windows XP machine

Finally go to your Windows machine (assuming you have File Sharing and all configured which I think it should be if you were able to follow the steps in my previous blog successfully) and type the following in your “Explorer Windows” and NOT “Internet Explorer” like this:

Windows Linux LoginNow enter your username and password – the one that you used in the smbpasswd command in Step 4 above. After that you should be able to see your home directory like this:

connected_login1

That’s it. As usual, please leave a comment/feedback, if you have any.

Be Sociable, Share!