Jump to content.

IFX Group

A DIFFERENT PERSPECTIVE CAN CHANGE EVERYTHING.

Linux SMB/CIFS Shares

It is important to note the methods described in this document do not follow best practices for security and may allow access to sensitive information. The goal of this document is local convenience over security.

A little background

In the beginning sharing some files between the computers on your local area network (LAN) was relatively simple. Microsoft Windows 95, 98 and NT3 users could right click on almost any drive letter or folder and select Share to let others access their files. File sharing was simple, equally compatible with all Windows versions and easy for novice users to control.

Then came Windows NT 4, Windows 2000, Windows XP, Windows 2003, Windows Vista, Windows 7, Windows 8 and others each with a different twist on file sharing that breaks 100% compatibility with other versions of Windows and devices that are compatible with the published Common Internet File System (CIFS) file sharing standards originally created and published by Microsoft.

To make the problem worse it is not possible to simply upgrade the operating system for all of the existing machines on every network because each new version of Windows does not properly run on "old" hardware and are widely known to not work with older peripherals. I put the word old in quotes because some of the new machines on my network are less than 6 months old. They run older versions of Windows and Linux perfectly well and fast enough for my production use. That same hardware either does not boot newer Windows versions or runs so painfully slow that it is totally unusable.

Could the choice of operating system have that much more to do with perception of performance and a fast user experience than the choice of hardware? It looks that way to me.

What is a savvy end user to do?

The answer is to keep your existing fast operating systems running and use some free software to match the different parts together.

This document describes using Xubuntu Linux, a well funded, actively developed and commercially supported version of Linux that you can download from www.xubuntu.com and burn to your own bootable CD-ROM. While you are at it, please make some extra copies of their Live CD and share them with your friends.

The latest Xubuntu works on almost any computer with a VGA card, a Pentium or better CPU, about 512 megabytes of RAM and the ability to boot from a CD or USB thumbdrive. Since this is about the same requirement as a low end Windows XP machine there should be no problem finding a free computer like this in your junk closet or a very inexpensive machine at your local used computer store. Keep in mind that extra memory is a very good thing for better performance even over a faster CPU.

Boot your machine with the Xubuntu Live CD, click on the Install icon on the desktop and follow the setup wizard through the install process. In this process you will be required to create a user name and password. Make sure this name and password exists in the SMB/CIFS Permits on your IPAD-OS server for a share that points to the IPAD's root directory.

The Setup

At this point you should be looking at the Xubuntu desktop that boots from the hard drive, not the live CD.

The first step is to make sure you have a working Internet connection. If you can open the Firefox web browser (the orange and blue circle icon) and reach a web site on the public Internet, like this web site, then you are connected. Having a working Internet connection is required for downloading packages to add features to the default install and later to help keep your operating system up to date and running bug free.

Start by opening a terminal window which is found under the Applications/Accessories menu. If you do not see this option, click on the Ubuntu Software Center choice at the bottom of the Applications menu to add it. While most or all of the following can be done with graphical tools, trying to describe how to do this is much more complex than just typing a few commands.

When you see the terminal command prompt, type sudo su (must be lowercase) to gain temporary root access. You will be prompted for the password you selected when your account was created. This method is used so the authentication remains until you close the terminal window or type the exit command.

When you have the terminal window open and have provided your password, we need to do three things.

  1. Make sure all parts of the SMB stack are installed
  2. Make a directory for your IPAD (more on this later)
  3. Edit two configuration files

Let's take each of these one step at a time.

Step 1: Make sure all three parts of the SMB stack are installed.

Type or copy the following line exactly as it appears.

apt-get install samba smbfs smbclient gedit

Note: this command line is case sensitive and must be entered in all lowercase letters. It is best to cut and paste it from this web page.

This downloads everything you need and makes sure SMB is installed on your system.

Step 2: Make a directory for the IPAD-OS.

This part is hard to understand at first for those accustomed to the Microsoft (DOS and Windows) way of connecting remote file servers to local drive letters like F: on your computer. Instead of drive letters, UNIX/Linux systems use directory trees where you connect remote file servers to a subdirectory on your file system. This is why we need to make an empty directory as a connection point.

To keep things very simple, we'll put the new directory under the media path with the following commands.

mkdir /media/shares
mkdir /media/shares/ipad

Note: this is case sensitive and should be entered in all lowercase letters.

Step 3: Edit the configuration files.

Now we need to do some file editing to quickly make sure we have all of the correct settings. While most of this can be done through the graphical programs included with Xubuntu, it is more direct to edit the two files once and then only tweak the settings through the graphical user interface if needed later.

3A) Edit /etc/fstab

Type the following command followed by the Enter key.

gedit /etc/fstab

Add the following line to the end of this file. Pay very close attention to not add any extra spaces where they are not represented here. Note: there are two numbers (both zero) separated by at least one space at the end of this line.

//ipad/system /media/shares/ipad sbmfs username=itsa,password=secret 0 0

It is best to move the cursor to the end of the last line of the file and then press the Enter key to add a blank line for this new entry. When you are done simply close gedit and save your changes when prompted.

3B) Edit /etc/samba/smb.conf

Type the following command followed by the Enter key.

gedit /etc/samba/smb.conf

Three lines need to be changed to look like the following. You may need to scroll to locate all three lines.

wins server = 172.25.1.1
workgroup = WORKGROUP
encrypt passwords = false

In our example above the wins server points to the IPAD-OS at 172.25.1.1 - use your IPAD's local IP address behind the firewall here. Do not use your IPAD's public IP address.

Make sure the old IP address is replaced with your new one. Do the same for the other lines to make sure the WORKGROUP is identical to the name set on your IPAD-OS and that the password encryption is set to false. Note: the SMB/ CIFS password encryption used in Windows file/printer sharing is weak protection and does not appear to gain much if anything in security which is why it is disabled here for maximum performance and compatibility.

If any of the above lines already exist in your file but start with a number (#) sign or semicolon (;) character, now is the time to remove those number sign comment characters too.

3C) Create a new share.

Now we need to create a new share. Move to the end of the smb.conf file and insert a blank line. Copy and paste the following block of text making sure each line is left justified with no leading spaces.

[ipad]
path = /media/shares/ipad
comment = Shared connections
available = yes
browsable = yes
public = yes
writable = yes
create mode = 0775

When you are done editing, close gedit and save your changes when prompted.

Step 4: Restart the SMB service and mount the remote share.

Now we just need to make sure the new control files are loaded and active by restarting the servers. At the command prompt type these commands followed by the Enter key.

/sbin/service smb restart
mount -a

Your IPAD-OS can now be accessed through SMB/CIFS from any machine on your network with the correct username and password. This same process can be used to combine virtually all of the file shares on your network into subdirectories below the /media/shares directory. Just follow steps 2, 3a and 4 to create the placeholder directory and add a line in fstab connecting a share to that directory.

Or if you trust everyone on your network, as would be the case on a home network, you can share just the /media/shares directory to grant access to all of the remapped shares under one drive letter.

First published 2007-02-07. The last major review or update of this information was on 2014-03-18. Your feedback using the form below helps us correct errors and omissions on this page.