Introduction: How to Setup Samba (file Server)

About: I am a high school student in Cairns, Queensland. Most of the time I am either at school, sleeping, doing stuff on my computer, making circuits of some kind or messing with 240v

This Instructable will guide you through configuring Samba

This Instructable is based on Linux Ubuntu 9.04. The instructions on setting it up with newer versions will be pretty much identical

I will focus on just setting up a file server in this Instructable, although Samba can be expanded to run as an Active Domain Controller for Windows and a lot more

Step 1: Background on Samba

Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients. Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients.

Samba-3 by Example explains further, saying:

Samba is software that can be run on a platform other than Microsoft Windows, for example, UNIX, Linux, IBM System 390, OpenVMS, and other operating systems. Samba uses the TCP/IP protocol that is installed on the host server. When correctly configured, it allows that host to interact with a Microsoft Windows client or server as if it is a Windows file and print server.

From The Official Samba HOWTO:

The goal behind the project is one of removing barriers to interoperability.

Samba is a software package that gives network administrators flexibility and freedom in terms of setup, configuration, and choice of systems and equipment. Because of all that it offers, Samba has grown in popularity, and continues to do so, every year since its release in 1992.

For more details on Samba or SMB, see:

Intro to Samba

Step 2: Let's Start!

First download and install the newest version of Ubuntu

Run update manager to update Ubuntu

To get Samba open terminal and run sudo apt-get install samba

Step 3: Configure Samba

Type sudo gedit /etc/samba/smb.conf in terminal to open and edit Samba's configuration file.

  • Scroll down to Global Settings in the .conf file

Change WORKGROUP to whatever you want your workgroup to be.

Add netbios name = server and replace server with whatever you want the servers name to be

  • Scroll down to Share Definitions in the .conf file

Change yes next to read-only to no if you want to be able to write to that drive

Change %S next to valid users to the users you want to be able to access this drive (we will add users to the system in the next step)

Un-comment the options there ([homes], comment, browseable, read only and valid users) by removing the ; in front of them

If you want to add more drives just repeat those options e.g.

comment = Data
path = /export
force user = thermoelectric
force group = users
read only = No

Path is where that shared drive is located.

Step 4: Adding Users to Samba

Add users to Ubuntu by typing this into terminal e.g
sudo useradd -c "Thermoelectric Rules" -m -g users -p password Thermoelectric

You replace password with that users password. You replace Thermoelectric Rules with your real name. You replace Thermoelectric with your user name.

Repeat that until you have made a account for all of your users

Then add the users to Samba by typing this into terminal e.g
sudo smbpasswd -a Thermoelectric
Replace Thermoelectric with your user name

Repeat until you have added all your users to Samba

Step 5: Start and Test Samba

Start Samba by executing this in terminal
sudo nmbd; smbd;

Configure the /export directory:
sudo mkdir /export
sudo chown Thermoelectric.users /export
sudo chmod u=rwx,g=rwx,o-rwx /export

Check that Samba is running correctly:

sudo smbclient -L localhost -U%

Connect to SERVER (netbios name) as Thermoelectric (your user name):

sudo smbclient //SERVER/Thermoelectric -UThermoelectric%password

Step 6: Finish!

I hope you enjoyed this Instructable.

If you experience any errors while installing and using Samba, I will be glad to help.

Have you succeeded installing and using Samba? If so comment!

Is there anything you think I need to add to this Instructable? Comment and tell me!

Thanks. Please comment and rate