« PreviousNext »

Using Samba in File Managers

28 April 2006

In my last post, I described how I set up and configured Samba.  Now it is time to see how to use Samba, both on the Windows and the Linux boxes.

First, to the Windows box.  Chapter 3 of the O'Reilly online Samba book offers a comprehensive discussion on how to set up a Windows client for use with Samba.  If you're familiar with networking in Windows, this is not a difficult process.  Basically, you just have to make sure that TCP/IP is active on the Windows box and then open Windows Explorer and look in My Network Places.  Of course, when I first looked in My Network Places, the Linux box wasn't there.  Not to worry said the documentation because a common problem is that browsing services are not set up correctly.  The simple fix is to select Start, Run and enter the name of the Samba server along with the shared directory.  So, I tried that by entering \\debian\shared_data and  a Windows Explorer window opened showing a list of files in the shared data directory on my Linux box.  Success!  I only had to do the Run \\debian\shared_data once.  Windows remembers the connection and it now appears everytime I open Windows Explorer under My Network Places as a folder.

Note that you can also just type in the name of the server, ie \\debian, and that will also work.  If Run \\debian doesn't work, you can also try accessing the Samba server using its IP address.  Just type \\192.168.0.40 in Run and that should work. 

OK.  Now over to the Linux box to see if I could access my Windows shared directories.  I found this to be more confusing, but that's probably because I haven't mastered (even a little bit) the concept of mounting drives/directories in Linux.  Back in the O'Reilly book in Chapter 5, there is a good discussion on how to set up UNIX clients when using Samba.  One section in that chapter talks about mounting the smbfs file system.  After a little experimenting, I was able to mount my Windows shared drive on the Linux box using this command smbmount //windows_box/shared_directory /home/tim/mnt/test.  This command takes a directory called 'shared_directory' from a Windows box named 'windows_box' and mounts it on the Linux box in a directory called /home/time/mnt/test.  Once the command has run, you can launch a file manager in Linux, navigate to /home/tim/mnt/test and access the files from your Windows shared directory in Linux.  One very important caveat that took me some time to discover is that you cannot include a '/' at the end of the names, ie //windows_box/shared_directory/, in this command.  If you do, you will get an error message.

Another way to mount shared drives is by using LinNeighborhood.  You can access it at Menu, Debian, Apps, Net.   When it opens, you may or may not see anything in the main window.  If nothing is there, try Add from the Toolbar.  You'll get a dialog box asking for machine, group and IP address.  To connect to my Windows box, I just type in the IP address and click on Query.  After doing that the name of my Windows box shows up in the main windows.  Now, right click again, this time on a specific machine name, ie Win_XP, and select Scan as User.  This time you should see a listing of your shared resources on Win_XP.  Now that LinNeighborhood has found all of the shared resources, you can also use the program to mount the resources.

To mount a drive, highlight the item that you want to mount, right click and select mount.  A dialog box pops up with all the options that you can select to mount the drive, the most important being where you want the drive to be mounted.  Select your desired options and click on Mount.  The mounted drives will be displayed in the bottom section of the LinNeighborhood screen.

To fine tune LinNeighborhood, I suggest you look at Prefs and set them to your liking.  When I first started trying to figure out Samba and networking on Linux some of the preferences didn't make much sense to me.  I have to admit that the first tab in Prefs, Scan is still a bit of a mystery to me.  I input my workgroup name, set the WINS server IP and checked the "always scan as user" option, but left everything else as it was.  The Programs tab is self-explanatory and demonstrates that LinNeighborhood is actually just a GUI front-end for the command that I discussed above.  The Miscellaneous tab allows you to input a default user and save a password for that user.  There are also other options dealing with mounting drives.  I haven't explored/tested all of them, but am attracted to the "Memorize Mounted Shares/Remount on nex Startup" option.  If that does what it sounds like, then I could set up my shares to be mounted where I want them and check this option and not have to worry about mounting the shared drives again.  The last tab in Prefs deals with Post Mount and gives you the option to run a file manager after mounting and, if so, which one.

So, it looks like Samba is up and running, at least at the very basic level.  I can access files on my Linux box from my Win Xp box and vice versa, which was my goal in this exercise.  The key will be to see how long everything "holds" together.  My experience has been, that after a couple of reboots on either machine, the network stops working and I have to spend time reconfiguring it.  Time will tell.  Once I determine that this setup is stable, I want to look into sharing printers across the network.  Something else to work on and report about in a future post.

Posted in Installing Packages & Programs, Linux | Trackback | del.icio.us | Top Of Page

No comments yet

Leave a Reply