Header Shadow Image

Networking: Sharing folders between Windows and Linux using Samba

Pages: 1 2 3

There are plenty of ways to share resources and files between two or more computers.  You could do things like:

  • Email yourself an attachment.
  • Use FTP between the two PC's.
  • Use SSH between the two computers.
  • Use sneaker-net: copy the files to Flash Disk, DVD, CD, (gulp) floppy etc. and walk over to the other computer then load them up.
  • Copy the file by hand.
  • etc (It pretty much just goes downhill from here).

Or you could enable NFS or better yet, as we will discuss here, use SAMBA and share entire folders, allowing you to simply save to a shared folder making the file / folder visible from other PC's on your network. 

We will therefore do two things over the network in this post using SAMBA:

  • Mount Windows shared folders on Linux.
  • Map Linux shared folders (Using Map Network Drive… option) on Windows.

This of course will be different then simply mounting partitions on the same machine as we have outlined in Windows / Linux: Mutually accessing various filesystems on the same PC. since will be doing this type of sharing over the network instead of just on the same PC.  In this post we will share folders between Fedora Linux and Windows, though the general config of the applications can apply to other distributions.  Overall, having said the above, here's how the setup can look like for you as well:

HTPC+B Shared Storage

Here's how to get this done:

LINUX : Mounting Shared Windows folders on Linux

Here are the steps in order to get SMB / SAMBA configured on the Linux host to see a windows shared path:

1 Check if you have the necessary packages, commands and daemons running.  (If you get command not found or No such file or directory, you'll need to install these prior to going further with the installation.)

Run the below to check if chkconfig and the SAMBA RPM's are installed:

# which chkconfig

# rpm -aq|egrep -i "smb|samba"

If anyone is missing, you can use:

# nice -n 19 yum search samba

to get a list of available packages to install from.

Check if the smb daemon is installed:

# chkconfig –list smb
smb             0:off   1:off   2:off   3:off   4:off   5:on    6:off

If nothing comes back other then the prompt, check if the service exists:

# ls -al /etc/init.d/smb
-rwxr-xr-x 1 root root 1745 2009-03-26 16:49 /etc/init.d/smb

and enable it in this manner:

# chkconfig –add smb 5

to add it to run level 5 (Linux GUI stage).  Then turn it on in this manner:

# chkconfig –level 5 smb on

Samba comes with an comprehensive set of commands to choose from.  Those most important to this post are enbolded:


 To find out version of package owning above files use:

# rpm -qf /usr/bin/smbclient

Finally, you can use:

# ps -ef |grep smbd
root      2026     1  0 Jul23 ?        00:00:00 smbd -D
root      2046  2026  0 Jul23 ?        00:00:00 smbd -D
root     14524  2026  0 Jul25 ?        00:00:00 smbd -D

to ensure it is in fact running.

If the daemon is not running you can restart it by running:

# service smb restart


# /etc/init.d/smb restart


2 Share a folder on the Windows PC so it is visible.  Before you can access the remote folders through Linux, they need to be shared first on the remote Windows PC.
  • In Windows, right click on the start button then choose
    Explore All Users
  • Browse to or create a folder you would like to share such as C:\HomeMovies or I:\HomeMovies etc.
  •  Right click the folder then select Properties… from the pop up menu.  On the popup menu select the Sharing tab.  You should see this panel:

SAMBA: Windows Sharing Properties Popup



  • Share this folder on the network is checked.
  • Share name: is set to either the default value or you can type your preference.
  • If you would like others to modify files on this disk, select Allow network users to change my files.  This will depend on whether you need to let others modify files there and the who will have access to it.

You will notice that after you do this there will now be a blue hand under that folder indicating it is shared:

SAMBA Shared Folder

as opposed to:

SAMBA Non-shared folder.

for non shared folders.

3 On Linux, verify that the remote Windows machine shares are visible.

For this, we wil use the smbclient command like this:

# smbclient -L
Enter root's password:
Domain=[MSWIN_NAME] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Sharename       Type      Comment
        ———       —-      ——-
        HomeVideos          Disk
session request to failed (Called name not present)
session request to 192 failed (Called name not present)
Domain=[WINPC_NAME] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Server               Comment
        ———            ——-

        Workgroup            Master
        ———            ——-

At least one shared folder off the remote Windows PC should be visible.  In this case, HomeVideos is visible, which is good.


 4 Mount the remote Windows shared drives and access them as if any UNIX folder.

Create a mount folder then use the mount command to mount the shared drive: 

# mkdir /mnt/HomeVideos
# mount -t cifs "//" "/mnt/HomeVideos" -ouser=windowsuser,pass=mypassword,domain=WINPC_NAME,rw

though even depending on permissions and setup, the default anonymous user should work (see further down):

# mount -t cifs "//" "/mnt/HomeVideos"

Test the drive by navigating to it and creating a test file:

# cd /mnt/HomeVideos
# touch test-file.txt

On your Windows system, check that the test-file.txt exists and remote it.  This simulates a short read and write test on both systems.


5 Help!  I've encountered problems!

See the Q&A below.  If you don't find the answer there, try to search this post as many errors I've encountered are listed in the Q&A.




Click below for next page…

Pages: 1 2 3

11 Responses to “Networking: Sharing folders between Windows and Linux using Samba”

  1. […] Tom Kacperski wrote an interesting post today onNetworking: Sharing folders between Windows and Linux using SambaHere’s a quick excerpt […]

  2. […] Networking: Sharing folders between Windows and Linux using Samba […]

  3. […] Networking: Sharing folders between Windows and Linux using Samba […]

  4. […] NT_STATUS_UNSUCCESSFUL Setting up rules in the firewall between server/client for ports 445,139 etc might do it for your […]

  5. […] it's all said and done then shared with the rest of the network , including a new Nexus 7 running Android through AndSMB, and tweaked for quick data transfers it […]

  6. […] Networking: Sharing folders between Windows and Linux using Samba Fedora Update: undefined symbol: DRIOpenDRMMaster […]

  7. […] Windows and Linux: Samba / CIFS Network Sharing […]

  8. […] follow us on our Samba / CIFS Connectivity page for the resolution to the issue.  Hope this helps […]

  9. […] tips on this Samba / CIFS Connectivity page may […]

  10. […] Windows and Linux: Samba / CIFS Network Sharing […]

  11. […] can also enable SMB / Samba file sharing on the individual cluster hosts and allow visibility to the Gluster FS / NFS – Ganesha […]

Leave a Reply

You must be logged in to post a comment.

  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License