Setting Up A Samba File Share Server

Setting up a Samba file share is the easiest method for connecting a media server to a variety of computers of differing operating systems. It also provides easy access to the server for adding and removing files; especially for those not familiar with the command line environment.

This tutorial assumes that you have basic knowledge of the command line environment and have a Ubuntu server already running with SSH installed.

Message of Caution

Before we get started I have a message of caution for when setting up any new type of server. Always, always, always back up configuration files before you edit them. Trust me. I learnt this the hard way on a different server which resulted in a few fresh installs. This is even more important on a SheevaPlug as fresh installs are not as straight forward as a regular server.

So before editing any configuration file, make sure you type

   cp configurationfile.extension configurationfile.extension.backup

Obviously replace the word configurationfile with the name of your file and use the proper extension. By adding .backup, or any other bogus extension, to the end of the file, you will preserve it in it's original state. If you mess up the original configuration file, just copy the backup to the same name as it originally was. By taking this precaution when editing config files, I guarantee that you will save yourself some serious pains down the line.

Installing and setting up Samba is very easy. First start by installing from the repository with

   apt-get install samba

Configuration

Now we're going to set up the Samba config file. Make sure you backup the file as per the instructions above before you make any edits. Open the file for editing with

   vi /etc/samba/smb.conf

Find the section Authentication section of the file. It will appear as so

   ####### Authentication #######
    # "security = user" is always a good idea. This will require a Unix account
    # in this server for every user accessing the server. See
    # /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
    # in the samba-doc package for details.
    #  security = user

Uncomment the line

   security = user

and add a line right after it so the final authentication section appears as so

   # "security = user" is always a good idea. This will require a Unix account
    # in this server for every user accessing the server. See
    # /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
    # in the samba-doc package for details.
       security = user
       username map = /etc/samba/smbusers

Adding A Folder To Share

Now of course you will want to share a specific folder with the users in your house. We are going to share the external hard drive we have attached at /media/external.

Once again open up the smb.conf file for editing and find the "Share Definitions" section and add the text below.

   #external media drive
    [server]
            comment = External Media Drive
            browseable = yes
            writeable = yes
            path = /media/external
            guest ok = yes

When you connect to the Samba share, you should have one option to select and that is "server". If you want to add more specific shares, duplicate the code above with your desired settings making sure that the name in the square brackets, currently "server", is different than the others. If you have more than one share set up, you will see the list of them upon connection.

Creating A Samba User

You can only create a samba user for a user that already exists on the system so make sure you've already done that before trying the next step.

This server is useless without users so lets add a user to Samba with the line

   smbpasswd -a username

It will prompt you for a password and then a confirmation. Once completed, you now have a samba user.

Now that your Samba file share is all set up you can try connecting from your computer. For Mac OSX users, in Finder, go to the menu "Go" and select "Connect to Server" and type

   smb://192.168.1.200

You will then be prompted for a username and password. Enter the proper credentials and select the share to connect to from the list provided. For our setup only "server" will be listed". After you connect, the file share will appear as a folder on your computer. From there you can stream media, add media and organize files from the comfort of your GUI desktop.

Short URL: http://gl2.ca/b