How do I quickly share Linux directories with a Windows network?

Jack Wallen walks you through the process of setting up a share on your Linux desktop so that all the machines on your network can access it.

So you broke down and finally set up a Linux machine on your network. And this time it's not a server! You're running one of the more recent distributions (let's say either Ubuntu 10.04 or Fedora 13) with the GNOME desktop. Here's the thing: you need to allow other users, those using Microsoft Windows-based machines, to have access to specific directories on that Linux box. How do you do it?

Believe it or not -- it's very simple, and you won't have to edit a single line of a Samba configuration file in order to get it working. This simplified process may come as a surprise to anyone who has tried to share a Linux directory on a Windows network in the past. Instead of having to weed through the smb.conf file as before, everything is done from within the GUI.

In this How do I tutorial, I walk you through the process of setting up a shared directory on your Linux desktop so that all the machines on your network can access it.

This blog post is also available in PDF format in a TechRepublic download.


You might be surprised to find out that once you have the desktop operating system installed, you have everything you need to begin this process. During the process, there may be (depending on your current installation) a dependency to be installed, but this will happen automatically when you start the set-up process. Outside of that, you will need the other machines connected to the same network. Those machines can be a part of either a domain or a workgroup -- it really doesn't matter.

Step 1

The first step (after you have decided what directory you are planning to share) is to open the Nautilus file manager, right-click on the directory to be shared, and select the Sharing Options entry. When you do this, a new window will open (Figure A) where you will enable the sharing of said folder.

Figure A

The first step is to check the Share This Folder checkbox.

If your system does not have all the requisite software, you will be walked through this process.

Step 2

If necessary, you will need to install the service (Samba) in charge of sharing your folders. Figure B shows the window that will warn you that not all dependencies are met.

Figure B

Once you click Install Service, you will have to enter an administrative password. If you are using an Ubuntu-like distribution (that uses sudo), just enter your user password.

Step 3

Once the service is installed, you will be taken back to the properties window where you can give the share a name and a description as well as select the options for the share. If you want to give read/write access for this folder, make sure the first option is checked. If you want guest access (access for those without an account on the machine sharing the folder), make sure the second option is checked.

After you are satisfied with the configuration, click the Create Share button.

Step 4

If you have enabled a feature requiring permission changes, you will need to let the Wizard automatically change the permissions for the share. Figure C shows the warning you will get for this step.

Figure C

If you do not allow the wizard to set these permissions, you will have to go back and manually set them. Make sure you do not skip this step.

Step 5

Once the service is installed, you have to restart Nautilus. Fortunately the Wizard will do this for you. As you can see in Figure D, the restarting of Nautilus is merely the click of a button. If by chance the window with the restart button does not appear, you can restart Nautilus by either issuing the command killall -9 nautilus or just logging out and logging back in.

Figure D

The restarting of Nautilus will be necessary only after the first share is set up. After that, Nautilus will not have to be restarted.

Step 6

You are now ready to test your shared directory. This is very simple. Go to one of your Windows machines and follow these steps:

1.               Open up Explorer.

2.               Enter \\IP_ADDRESS_TO_SHARE.

3.               Depending on how you have this set up, you might have to enter a username and password.

If there were no problems, you will now have access to your Linux shares from your Windows machine.

If you are attempting to reach that same Linux share from an OSX machine, do the following:

1.               Open Finder.

2.               Click <Apple>k.

3.               Enter smb://IP_ADDRESS_TO_SHARE.

4.               In the new window, enter the username/password (if necessary) for the share.

That's it! You now have access to your Linux share from your OSX machine.

Final thoughts

At one point it was a real challenge to get Windows machines to see shared files and directories on a Linux machine. Manually editing the smb.conf file required a much higher level of knowledge than what is required now. Thanks to the latest releases of major players in the Linux desktop and distribution landscape everything has become far more user friendly.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic's Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen....