A Samba File Server And Network For Your Home/Small Office

Do I Need A File Server?

A file server stores the data from a number of computers in one place.  In addition, security is provided through secure access (username and password), with authorized permissions established for controlling usage of a single user, a specific group of users, and anyone else that may or may not access the server.  A file server then is more than just data storage.  It can make your data easier to control, find, backup and restore, as well as providing privacy by keeping the data available only to those “authorized” to see it.  In its simplest form, to use a files server, one needs only to create some files on a computer, and have users save their data over a network to those files, rather than saving the data to their local hard drives.  On my home network, the computers have mostly program files on their hard drives, whereas the server holds all the data.

Super, now that we know what a file server is, do you really need one?  Like the answers to most questions in life, the answer here is not totally obvious.  To determine the need for a file server, it depends on the number of computers that would potentially use the server; the purpose of those computers; if multiple users need to share or collaborate on the same data;  the proximity of the computers to each other, as well as the need for the data’s security.  All that being said, at home, if you only have a couple of computers being used, a file server probably would not be of much benefit.  On the other hand, if you are a world class Geek like myself, where you have and use a number of computers in your home (I have 4 ), your need for a file server is duly noted, and hereby approved.

In an office, again with a couple of computers, a file server may not be necessary; however, what if two users often work together on the same project, and both need access to the data?  Having that data available at a centralized location makes a lot of sense, instead of having the pieces of a project stored on two different computers.  Generally speaking, the more computers that are being used, along with the need for sharing data among the computer users, the greater need one has for a file server.

Setting Up A Local Area Network (LAN)

Before setting up a server, you need a digital hi-way that will allow data to travel both to and from the server.  This is a Local Area Network (LAN).  If you currently access the internet through a Router, then you are in luck as you already have the backbone of your network in place.  Simply put, a router is a device that connects two networks together.  In most cases, a router connects an internal network to the Internet.  Currently, you may have an Ethernet cable going from you computer to a router, or to a DSL or cable modem.  If only the DSL/Cable modem is present, not to worry, that modem may well be a router, it is just functioning with the router hardware shut off.   If your modem was supplied by your ISP, ask your internet service provider how to access the modem (usually done by using the actual IP address of the modem, through a browser.  For example:  In the address portion of your browser you would type in:  192.168.1.1).  You also need the username and password for the modem so you can access the device.   Once inside the modem, you want to turn on DHCP, so IP addresses are automatically assigned to your PCs.  Most routers have a built in Switch (a number of Ethernet ports with the flow of data traveling through the ports  managed).  Usually 4 Ethernet ports are available.  In one of these ports, assuming you are on a wired network, you would install your Ethernet cable (preferably Category 5e or 6) from each of your computers (assuming each of those computers has an Ethernet card installed).  If you only have a modem, and it only has one Ethernet port, not to worry.  You can purchase a switch (street price $20 and up), run a cable from each of your computers to the switch, and one cable from the switch to the modem.   At this point, if you are using Mac OS X, you don’t have to do anything else.  For non-Mac owners, you need to go into each computer’s network settings and set DHCP to automatic, and provide a workgroup name (be sure to use the same workgroup name on each computer).  If you are using Samba to connect to and from Linux/Unix/Windows machines, you must change the smb.conf to add the workgroup name (see last week’s article in this blog, “Samba Server (File Sharing) Setup”).

What if you only have a dial up modem?  Not to worry, you can still set up your network, by purchasing a switch, and running an Ethernet cable from each computer’s Ethernet port, to an available port on the switch.  Note that in this example, unless you set up a Proxie server, only the computer directly attached to the dial-up modem will be available to connect to the Internet.  Finally, in this example you will also have to set up each computer’s IP address, and subnet mask manually.  Usually these settings are found in the network portion of your computer’s configuration settings.  Once in these settings, there is some sort of button or box to check for manual configuration of the IP address and subnet mask for the computer.  Start with an IP address of 192.168.1.100, and a subnet mask of 255.255.255.0.  Use the same subnet mask for each computer on your network.  When you setup your next computer’s IP address, increase the IP address by one digit, in this example, it would be: 192.168.1.101.   In addition, you will need to add a workgroup name, as mentioned above.

What if you don’t want a wired connection?  You want to go wireless.  Make sure you have a wireless router (duh), that each computer has a wireless network card or adapter, and check with your router’s instructions for network setup.  In most cases,  the  DHCP is set to automatic in the router, you will be asked to name your wireless network, and your security settings and password for those settings are created by you and entered into the router interface.  Then on each computer,  there should be a wireless setup, where you will again set DHCP to automatic, if it is not set there already.  You will be presented with a list of wireless networks broadcasting in your area, find yours using the name you just created.  Then you will be prompted for the password you entered into the security settings of the router, and you will be authenticated, and “on” the network.  The next time you log into your PC, all this will be done automatically, and you will always be “on” the wireless network.

For more information on setting up your local area network:

What Do You Need To Build Your Server?

You should arm yourself with some information.  The following articles available in this blog will help you:

  • Samba Server (File Sharing) Setup
  • Linux and Unix File Permissions
  • Some Things To Consider Before You Install Linux
  • Run Two Computers With A single Keyboard And Mouse (There is an original article and an update)
  • For those of you wishing to run a wireless network: Re-purpose Your Old WiFI Router As A Super Router Or Repeater With DD-WRT

A computer.  This PC does not have to be a powerhouse, or very new.  It does however need to be reliable, and a key to that is simplicity.  Here are some minimum specifications you should consider:

  • Processor.  A single core Pentium 4 or AMD (Athlon, Sempron, etc.) or newer.
  • Motherboard.  It should support SATA drives and have Ethernet on board.
  • Hard Drive.  One of the few upgrades I do to an old PC that I am converting for use as a server is install a new hard drive.  Hard drives to wear out, and I have to assume an “old” PC has had some heavy use.  As the server will now hold most if not all of my data, a new drive is pretty cheap insurance.  A SATA drive is the only way to go here, and though there are several versions of SATA hard drive controllers developed over the last several years, most current drives are backward compatible (a quick check on the hard drive manufactures website will verify this).
  • RAM Memory.  For use at home or a small office, the size of memory you will need depends on the minimum requirements for your choice of operating system.  Typically, an operating system with no, or a simple graphic user interface will require less memory than Windows, KDE, GNOME, etc.
  • Power Supply.  With an older PC, next to the hard drive, this part gets my vote for “Most Likely To Fail”.  Use, dirt, and heat generally take their tole on the power supply.  Symptoms can range from the computer locking up, to it simply shutting off unexpectantly, and finally when terminal, the PC will not start (no power).   These are not characteristics I want to see in a computer, and especially not in my file server.  Unless the power supply in your PC is proprietary (meaning a device specially designed for use in a specific brand/ model of PC), I would pull it out and replace it with a new one.

An operating system.  On an older PC, you could use the existing operating system.  For me, using older operating systems is risky because of potential security issues.  That being said, current Linux and Unix based distributions become a pretty compelling choice for a secure, fast, and free solution for a home or small business server.

 In choosing a Linux operation system, you want a distribution without all the “bells and whistles”.  You don’t need office suites, internet applications, graphic design programs, etc.  Most Linux distributions offer choices for the graphic user interface.  KDE and Gnome are the most popular choices for desktop applications.  Both are great for a desktop PC, but are way “over the top” for a server.   If you need a GUI to get the server setup and running go with LXDE or Xfce.  Most popular Linux distro’s offer either/or both of these light weight graphic user interfaces.  LXDE and Xfce are simple and require less system resources (this means faster response, and less things to go wrong).  In addition, they take up less space on your hard drive.  That being said, I recommend Mint, Ubuntu, or Debian Linux, each with the light weight interfaces mentioned.   If you are comfortable with the command line, Ubuntu Server is a great choice.  I have been using it for quite awhile now, and have had “0” issues with it.  Here is some information for installing a Linux operating system on your server:

An additional operating system solution is FreeNas.  Based on FreeBSD (Unix), this is an excellent and rock solid operating system.  It is recommended that the OS be installed on a flash drive (the OS takes 2 GB), and run from the same drive.  The install if fairly simple.  The size of the software has increased over the years, but it is still a full featured and very robust OS.  After the install, it  allows for further configuration through command line or your web browser.  It supports most popular network protocols (Samba, NFS, etc.).   You can find out more about it from:  http://www.freenas.org.

Tip:  If you are given a choice of what software to install during the operating system installation process (depending on distribution of Linux you may or may not have this option), be sure to install Samba and SSH (secure shell).

Simplify your hardware.  For a server, reliability and simplicity go hand-in-hand.  If you are experienced in doing computer modifications, I recommend you go into the bios and shutdown anything that you are not using, and use conservative settings (for example, you won’t need to use Shadow Bios, or any enhanced video card settings).  I know I could be more explicit here, but bios settings vary a great deal from manufacturer, type of motherboard, and production run.  Be safe,  if you don’t know what the process is, don’t kill it.

If you are command line savvy, you can control your server using SSH, a secure shell from any PC on your network.  By doing this your server will have no need for a monitor, keyboard, or mouse.  We’ll discuss in more detail later, but for now, somewhere in the bios you will see an option “Halt on Errors”.  The bios will look for the keyboard, mouse, and monitor, and by switching this command to “off”, the computer will still boot after not finding them.

Setting Up Files To Share

At this point, I will assume you are familiar with Samba, or have read my article,  Samba Server (File Sharing) Setup (http://wp.me/p2J68t-3U). Here are the examples of Samba file shares used in the article (they would be entered into the last section of the smb.conf file):

Sample smb.conf file part 4

In each of the examples above, Samba is told where each file to be shared with other computers is located on the server, and that anyone in the group users can access the file with read, write, and execute permissions.  This is a simple setup.  However, say in your home, there are 4 users saving data to the server, and each user wants their own private file.  Here is an example of setting up a share that meets those needs:

Smb.conf homes section

When a user is added to the server, a home directory is created in the server’s files system, and this share limits access to the specific home directory of the logged in user. Once the user accesses their home directory, the user has read, write, and execute access.

The examples of file shares shown here should suffice most needs for file sharing in a home or small office network; however, these examples barely scratch the surface of what Samba can do.  For more information, check the documentation found at Samba.org

Doing Away With The Server’s Monitor, Keyboard, and Mouse

Your server provides access and storage for your data. The computer’s functionality is limited, so once the operating system is installed, configured, and file shares are set up, there is really little need for input devices or a monitor.  You can shutdown the server, perform upgrades, and software maintenance from any computer on your network using a Secure Shell.  Wikipedia clearly defines the program as follows:  “Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client (running SSH server and SSH client programs, respectively).”

Below, is an example of me accessing my server using SSH (Secure Shell) from the terminal program in my iMac.

SSH Login Example

The second line shows me establishing a connection with my file server using the secure shell.  I am accessing the computer as user “root”, and I am providing the local address for the server.  After I hit the Enter key, I am asked for root’s password on the server, and once the password is authenticated, I am in.  At this point, Ubuntu (the operating system on my server) is showing me some information about my server, and also is advising me of some updates.  I am then at the command line of the server, with root access.  From this point, I can use the  command line, just like I would if a monitor and keyboard were attached to the server.  When I am done with my work on the server, I type “Exit” and I am back into the terminal program on my iMac.

To shut the server down from with the Secure Shell, type the following:  shutdown -h now | exit        This string tells the computer to shutdown, halt all processes, and do this NOW; finally, you exit ssh, and you are back at your terminal program.

SSH must be installed on your server, and any Windows or Linux computer you want to use to access, via ssh, the server.  Mac OS X comes with the software already installed.  For Window’s machines, PuTTY is a popular software to use for this, and there are numerous SSH open source software programs available for Linux, – check in your Linux program’s package manager.  Note:  For your server, you will need SSH server software, and other computers on the network will need SSH client software.

Summary

The goal of this document is to provide enough information and sources to help you create a simple local area network with a Samba file server to support its users.  The only way to be totally thorough in the presentation of this topic would be to write a book on the subject, and indeed I am sure there are such books available.   What I have attempted to do, is to pare down the world of information available to only the essentials, and present them to you.  Hopefully, I have done so, successfully, and the goal of this document has been met.

There are no comments yet

Why not be the first

Leave a Reply